我是新來的ANT。我有以下項目結構,ANT編譯失敗
Project
module1
build.xml
module2
build.xml
lib
發生的事情是,我已經在模塊2配置的build.xml構建模塊2類的JAR並把它放在lib文件夾。現在,我從module1的build.xml中調用build.xml fo module2。 module1需要module2的JAR進行編譯。我可以在lib文件夾中看到JAR,但仍然沒有編譯模塊1。 有人可以幫我嗎? 這裏我的build.xml文件, 模塊1的build.xml,
<?xml version="1.0" encoding="UTF-8"?>
<property name="app.name" value="module1" />
<property name="src.home" value="${basedir}/src/main/java" />
<property name="build.home" value="${basedir}/build" />
<property name="ear.home" value="${basedir}/ear" />
<property name="module2.home" value="../module2" />
<property name="external.lib.dir" value="../lib" />
<path id="lib.path">
<fileset dir="${external.lib.dir}">
<include name="*.jar" />
</fileset>
</path>
<path id="module2.path">
<filelist dir="${module2.home}" />
</path>
<target name="clean">
<delete dir="${build.home}" />
<delete dir="${ear.home}" />
</target>
<target name="prepare" depends ="clean"
description="Create build dirs and copy static files to work dir">
<mkdir dir="${build.home}" />
<mkdir dir="${build.home}/classes" />
</target>
<target name="compile" depends="prepare"
description="Compile Java sources and copy to build/classes dir">
<javac includeantruntime="false" srcdir="${src.home}" destdir="${build.home}/classes">
<classpath refid="lib.path" />
</javac>
<copy todir="${build.home}/classes">
<fileset dir="${src.home}" excludes="**/*.java" />
</copy>
</target>
<target name="includeJar">
<subant target="buildJar">
<fileset dir="../module2/" includes="build.xml" />
</subant>
</target>
<target name="buildEar" depends="includeJar,compile">
<jar destfile="${basedir}/ear/${app.name}.ear" basedir="${build.home}" />
</target>
這裏是模塊2的build.xml,
<?xml version="1.0" encoding="UTF-8"?>
<project name="module2">
<property name="app.name" value="module2"/>
<property name="src.home" value="${basedir}/src/main/java"/>
<property name="build.home" value="${basedir}/build"/>
<echo>
module2 build.xml
</echo>
<target name="clean">
<delete dir="${build.home}"/>
</target>
<target name="init" depends="clean"
description="Create build dirs and copy static files to work dir">
<mkdir dir="${build.home}"/>
<mkdir dir="${build.home}/classes"/>
</target>
<target name="compile" depends="init"
description="Compile Java sources and copy to build/classes dir">
<javac includeantruntime="false" srcdir="${src.home}"
destdir="${build.home}/classes">
</javac>
<copy todir="${build.home}/classes">
<fileset dir="${src.home}" excludes="**/*.java"/>
</copy>
</target>
<target name="buildJar" depends="compile">
<echo>Inside buildJar of module2
</echo>
<jar destfile="../lib/${app.name}.jar"
basedir="${build.home}"
/>
</target>
請張貼的build.xml文件,有什麼可以happenning –
編輯我的職務更好的視野遏制build.xml文件 – paary
@Mark - 它的工作現在。發佈以下更改。謝謝:) – paary