* 我发现一个问题是调用一个Ant脚本,该脚本从构建主项目的另一个Ant脚本构建一个依赖项目(名为 ShellExtBridge )。
在主项目中,我有一个名为 init 的目标,该目标调用 ShellExtBridge的 build.xml 文件项目,以这种方式:
<target name="init">
<ant antfile="../../ShellExtBridge/Project/build.xml" dir="../../ShellExtBridge/Project/" />
<copy file="${basedir}/../../ShellExtBridge/Release/shellExtBridge.jar" tofile="/usr/share/XCloud/appl/lib/shellExtBridge.jar" />
........................
........................
........................
然后这是与 ShellExtBridge 项目相关的 build.xml 文件:
<?xml version="1.0"?>
<project>
<!-- ============================================ -->
<!-- Load build properties -->
<!-- ============================================ -->
<property name="project.buildfile" value="build.num" />
<property file="${project.buildfile}" />
<property file="info.properties" />
<!-- Elimina le cartelle contenenti le classi compilate ed i jar -->
<target name="clean">
<delete dir="../Release" />
<!-- Elimina directory del jar finale -->
<delete dir="bin" />
<!-- Elimina directory delle classi compilate -->
</target>
<!-- Contiene i task di COMPILAZIONE:
1) Crea la directory "bin/" nel progetto
2) Compila tutte le classi dentro la cartella "src" del progetto e mette i risultanti .class
dentro "bin"
-->
<target name="compile">
<mkdir dir="bin" />
<javac srcdir="src" destdir="bin" />
</target>
<target name="jar" description="Packs classes of shellextbridge">
<jar destfile="../Release/shellExtBridge.jar" index="false">
<fileset dir="bin" />
<manifest>
<attribute name="Created-By" value="${info.software.author}" />
<attribute name="Main-Class" value="com.techub.crystalice.rmi.Main" />
</manifest>
</jar>
</target>
</project>
如果我手动执行 ShellExtBridge 的 build.xml ,它可以正常工作,并将.jar结果放在正确的Release目录中。
但是,如果我尝试从我的主项目的 build.xml 执行它似乎不起作用(似乎不调用它),事实上我在Eclipse控制台中获取以下错误消息:
Buildfile: /home/andrea/Documenti/XCloud/Implementazione/CrossPlatform/CrystalIceGUI/Project/build.xml
init:
BUILD FAILED
/home/andrea/Documenti/XCloud/Implementazione/CrossPlatform/CrystalIceGUI/Project/build.xml:133: Warning: Could not find file /home/andrea/Documenti/XCloud/Implementazione/CrossPlatform/ShellExtBridge/Release/shellExtBridge.jar to copy.
Total time: 1 second
正如您所看到的,似乎与 ShellExtBridge 项目相关的 build.xml ant脚本永远不会被调用,因为此项目的最后一个jar未被创建
为什么呢?我错过了什么?
TNX
安德烈