2013-07-13 36 views
0

我已经JAVA_HOME和ANT_HOME都设置:构建失败的apache-tomcat的-7.0.42-SRC的build.xml

[email protected]:~/apache-tomcat-7.0.42-src$ echo $ANT_HOME 
/home/damechen/tmp/damechen/apache-ant-1.9.1 
[email protected]:~/apache-tomcat-7.0.42-src$ echo $JAVA_HOME 
/usr/lib/jvm/jdk1.7.0.25 
[email protected]:~/apache-tomcat-7.0.42-src$ java -version 
java version "1.7.0_25" 
Java(TM) SE Runtime Environment (build 1.7.0_25-b15) 
Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode) 

我试图使用Ant构建Tomcat,但它失败相关的一些原因build.xml文件。

BUILD FAILED 
/home/damechen/apache-tomcat-7.0.42-src/build.xml:2396: The following error occurred while executing this line: 
/home/damechen/apache-tomcat-7.0.42-src/build.xml:2625: Directory /usr/share/java/tomcat-native-1.1.27 creation was not successful for an unknown reason 
    at org.apache.tools.ant.taskdefs.Mkdir.execute(Mkdir.java:70) 
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292) 
    at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
    at java.lang.reflect.Method.invoke(Method.java:606) 
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) 
    at org.apache.tools.ant.Task.perform(Task.java:348) 
    at org.apache.tools.ant.Target.execute(Target.java:435) 
    at org.apache.tools.ant.Target.performTasks(Target.java:456) 
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393) 
    at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38) 
    at org.apache.tools.ant.Project.executeTargets(Project.java:1248) 
    at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:440) 
    at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:105) 
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292) 
    at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
    at java.lang.reflect.Method.invoke(Method.java:606) 
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) 
    at org.apache.tools.ant.Task.perform(Task.java:348) 
    at org.apache.tools.ant.Target.execute(Target.java:435) 
    at org.apache.tools.ant.Target.performTasks(Target.java:456) 
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393) 
    at org.apache.tools.ant.Project.executeTarget(Project.java:1364) 
    at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) 
    at org.apache.tools.ant.Project.executeTargets(Project.java:1248) 
    at org.apache.tools.ant.Main.runBuild(Main.java:851) 
    at org.apache.tools.ant.Main.startAnt(Main.java:235) 
    at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280) 
    at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109) 

Total time: 0 seconds 
[email protected]:~/apache-tomcat-7.0.42-src$ 

任何人都可以请给我个忙吗?非常感谢!

回答

1

正如例外说的那样。在尝试通过/usr/share/java/中的名称tomcat-native-1.1.27创建目录时,内置失败。

请给予适当的权利。

+0

感谢Junaid。这是在build属性文件中没有正确设置目录的原因。我改变了它,并且解决了这个问题的失败问题:) – damingzi

1

你需要阅读的Apache Tomcat构建指令:构建

  1. 构建是通过创建一个$ {控制

    (3.2) tomcat.source} /build.properties 文件。

    建议始终创建文件,因为不幸的 base.path属性的默认值。你可以用下面的 内容的文件开始:通过将其添加到 $

    # ----- Default Base Path for Dependent Packages ----- 
    # Replace this path with the directory path where dependencies binaries 
    # should be downloaded 
    base.path=/home/me/some-place-to-download-to 
    
  2. 配置base.path属性{} tomcat.source文件/build.properties中。

    base.path属性指定下载构建所需的Tomcat依赖关系 的位置。建议将这个 目录放在源代码树之外,这样就不会浪费您的时间重新下载这些库。

    • 警告:base.path属性的默认值使构建脚本 下载到构建Tomcat到/ usr/share/java目录 目录所需的库。在典型的Linux或MacOX系统上,普通用户不会有 访问权限写入此目录。即使您确实有权访问 该目录,但您可能不适合在此处编写该目录。

注意最后警告....这是你的问题的根本原因。

分析

build file被调用 “下载-2” 的目标时,它失败:

<target name="extras-commons-logging-prepare" 
      depends="extras-prepare" 
      description="Prepare to build web services extras package"> 

    <antcall target="downloadfile-2"> 
     <param name="sourcefile.1" value="${commons-logging-src.loc.1}"/> 
     <param name="sourcefile.2" value="${commons-logging-src.loc.2}"/> 
     <param name="destfile" value="${commons-logging-src.tar.gz}"/> 
     <param name="destdir" value="${commons-logging.home}"/> 
    </antcall> 

    .. 
    .. 

在你的构建。属性文件已设置的公地logging.home财产目录路径的值,你没有权限创建一个目录,即:

/usr/share/java/... 

进一步挖掘我看到default properties文件设置此路径如下:

# ----- Default Base Path for Dependent Packages ----- 
# Please note this path must be absolute, not relative, 
# as it is referenced with different working directory 
# contexts by the various build scripts. 
base.path=/usr/share/java 
#base.path=C:/path/to/the/repository 
#base.path=/usr/local 

.. 
.. 

commons-logging.version=1.1.1 
commons-logging.home=${base.path}/commons-logging-${commons-logging.version} 
+0

谢谢马克!请参阅下面的答案:) – damingzi

+0

@damingzi您提供给自己的问题的答案实际上是一个新问题。我想这就是为什么它被主持人删除。 –