我的第一个蚂蚁脚本问题

时间:2011-11-10 13:14:27

标签: java ant build.xml

我有一个build.xml文件,如下所示:

<project name="My Project" default="jar" basedir=".">

    <property name="dir.src" value="src"/>
    <property name="dir.build" value="build"/>
    <property name="dir.dest" value="dest"/>

    <target name="clean" description="Removing the all generated files.">
        <echo message=" clean starts" />
        <delete dir="${dir.build}"/>
        <delete dir="${dir.dest}"/>
        <echo message=" clean ends" />
    </target>

    <target name="prepare" depends="clean">
        <echo message=" prepare starts" />
        <mkdir dir="${dir.build}"/>
        <mkdir dir="${dir.dest}"/>
        <mkdir dir="${dir.src}"/>
        <echo message=" prepare ends" />
    </target>

    <target name="compile" depends="prepare" description="Compilation of all source code.">
        <echo message=" complile starts" />
        <javac srcdir="${dir.src}" destdir="${dir.build}"/>
        <echo message=" complile ends" />
    </target>

    <target name="jar" depends="compile" description="Generates Roseindia.jar file in to the 'dest' directory.">
        <echo message=" jar starts" />
        <jar jarfile="${dir.dest}/roseindia.jar" basedir="${dir.build}"/>
        <echo message=" jar ends" />
    </target>

</project>

当我运行它时,我得到关注op.I认为它是错的。我想做干净,准备,编译和buld jar。

Buildfile: C:\Project\Workspaces\Wrk_tst\TestPrj\build.xml
clean:
     [echo]  clean starts
     [echo]  clean ends
prepare:
     [echo]  prepare starts
    [mkdir] Created dir: C:\Project\Workspaces\Wrk_tst\TestPrj\build
    [mkdir] Created dir: C:\Project\Workspaces\Wrk_tst\TestPrj\dest
     [echo]  prepare ends
compile:
     [echo]  complile starts
    [javac] Compiling 1 source file to C:\Project\Workspaces\Wrk_tst\TestPrj\build
     [echo]  complile ends
jar:
     [echo]  jar starts
      [jar] Building jar: C:\Project\Workspaces\Wrk_tst\TestPrj\dest\roseindia.jar
     [echo]  jar ends
clean:
     [echo]  clean starts
   [delete] Deleting directory C:\Project\Workspaces\Wrk_tst\TestPrj\build
   [delete] Deleting directory C:\Project\Workspaces\Wrk_tst\TestPrj\dest
     [echo]  clean ends
prepare:
     [echo]  prepare starts
    [mkdir] Created dir: C:\Project\Workspaces\Wrk_tst\TestPrj\build
    [mkdir] Created dir: C:\Project\Workspaces\Wrk_tst\TestPrj\dest
     [echo]  prepare ends
compile:
     [echo]  complile starts
    [javac] Compiling 1 source file to C:\Project\Workspaces\Wrk_tst\TestPrj\build
     [echo]  complile ends
clean:
     [echo]  clean starts
   [delete] Deleting directory C:\Project\Workspaces\Wrk_tst\TestPrj\build
   [delete] Deleting directory C:\Project\Workspaces\Wrk_tst\TestPrj\dest
     [echo]  clean ends
prepare:
     [echo]  prepare starts
    [mkdir] Created dir: C:\Project\Workspaces\Wrk_tst\TestPrj\build
    [mkdir] Created dir: C:\Project\Workspaces\Wrk_tst\TestPrj\dest
     [echo]  prepare ends
clean:
     [echo]  clean starts
   [delete] Deleting directory C:\Project\Workspaces\Wrk_tst\TestPrj\build
   [delete] Deleting directory C:\Project\Workspaces\Wrk_tst\TestPrj\dest
     [echo]  clean ends
BUILD SUCCESSFUL
Total time: 669 milliseconds

1 个答案:

答案 0 :(得分:1)

看看输出似乎依赖性就好了。 当你开始构建时,由于jar目标具有依赖性,所以目标执行得很好。

你得到的问题是什么?你的输出似乎没有任何错误。