我是新来的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