1

我正在使用 ANT 脚本来构建我在 Eclipse 工作区中拥有的项目的 jar。我使用的命令是ant -f <build_file.xml>

我只想使用 ant 脚本来构建项目(目前我正在使用 eclipse 来做这个)。谁能帮我吗?

4

3 回答 3

4

ant 手册ANT 教程将是最好的起点。

于 2010-01-05T13:51:04.220 回答
3

这将使用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>
于 2010-01-05T14:33:21.913 回答
1

您的 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]

于 2010-01-05T17:02:01.967 回答