我正在使用 ANT 脚本来构建我在 Eclipse 工作区中拥有的项目的 jar。我使用的命令是ant -f <build_file.xml>
我只想使用 ant 脚本来构建项目(目前我正在使用 eclipse 来做这个)。谁能帮我吗?
这将使用my_prj/lib中的 jar将my_prj/src中的 Java 文件编译为my_prj/classes。
<javac srcdir="my_prj/src"
destdir="my_prj/classes"
debug="on">
<classpath>
<fileset dir="my_prj/lib">
<include name="**/*.jar"/>
</fileset>
</classpath>
</javac>
您的 Ant 构建脚本将包含几个您可以调用的目标。从命令行使用-p
开关列出可用的选项及其描述:
ant -f mybuildfile.xml -p
然后,您可以调用列出的目标之一:
ant -f mybuildfile.xml sometarget
[Note: the -f
is not necessary if the build file is called build.xml
, as is the usual convention]