蚂蚁目标输出太多次

时间:2010-10-07 14:44:08

标签: ant

我有一个看起来像这样的ant文件:

<?xml version="1.0" encoding="UTF-8"?>
<project name="p" default="compile" basedir=".">
<path id="compile.cliClasspath">
    <fileset dir="./WebContent/WEB-INF/lib">
        <include name="*.jar" />
    </fileset>
</path>

<target name="init">
    <!-- Create the time stamp -->
    <tstamp />
</target>

<target name="compile" description="compile the source" >
    <javac srcdir="./src/" destdir="C:\TEMP\build">
        <classpath refid="compile.cliClasspath" />
    </javac>
</target>

<target name="createWar" depends="compile" description="create web archive">
    <war destfile="C:\TEMP\client.war"
            webxml="./WebContent/WEB-INF/web.xml"
            needxmlfile="true"
            basedir="./WebContent"
            excludesfile="./WebContent/WEB-INF/application.xml">
        <lib dir="./WebContent/WEB-INF/lib" />
        <classes dir="C:\TEMP\build" />
    </war>
</target>

<target name="createEar" depends="compile, createWar" description="create enterprise archive">
    <ear destfile="C:\TEMP\Client.ear"
            appxml="./WebContent/WEB-INF/application.xml"
            includes="C:\TEMP\Client.war" />
</target>

<target name="cleanUp" depends="compile, createWar, createEar" description="clean up">
    <delete includeemptydirs="true">
        <fileset dir="C:\TEMP\build" includes="**/*" />
    </delete>
</target>
</project> 

我的想法是用我的网络应用程序的内容创建一个耳朵。当我运行它(按照文件中的顺序运行,从galileo运行)我得到这个:

    Buildfile: C:\Client-was7.xml
       <snip>init:

compile:
       [javac] Compiling 47 source files to C:\TEMP\build

compile:
       [javac] Compiling 47 source files to C:\TEMP\build

createWar:
         [war] Building war: C:\TEMP\Client.war

compile:
       [javac] Compiling 47 source files to C:\TEMP\build

createWar:
         [war] Building war: C:\TEMP\Client.war

createEar:

compile:
       [javac] Compiling 47 source files to C:\TEMP\build

createWar:
         [war] Building war: C:\TEMP\Client.war

createEar:

cleanUp:
BUILD SUCCESSFUL
Total time: 15 seconds

为什么输出不是:

init:

compile:

createWar:

createEar:

cleanUp:
    BUILD SUCCESSFUL
    Total time: 15 seconds

由于

1 个答案:

答案 0 :(得分:3)

我认为这可能与依赖目标有关。当你运行create ear时,首先运行compile,然后创建war,这也取决于编译等等。