查看当前 build.xml 文件中的内容可能很有用,但您可能想要查看的部分是<target>
元素,特别是<src path>
and<fileset>
元素。这是一个非常粗略的示例,其中包含一些指导变量。
<property name="classes.home" value="/myproject/src"/>
<target name="compile_myproject" depends="clean">
<javac destdir="${classes.home}" debug="off" optimize="on" deprecation="on">
<classpath>
<fileset dir="/location/of/jars/">
<include name="*.jar"/>
<exclude name="jar-I-dont-want.jar"/>
</fileset>
<fileset dir="/location/of/axis2/jars">
<include name="**/*.jar"/>
</fileset>
</classpath>
<src path="${classes.home}"/>
<include name="/test/**/*.java"/>
<include name="other/location/*.java"/>
<exclude name="/debug/and/useless/files/**/*.java"/>
</javac>
</target>
请注意,这${classes.home}
是在 build.xml 文件顶部定义的特殊变量。许多变量可用于使事情变得更容易并指定相对路径。