ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Weintraub" <qazw...@gmail.com>
Subject Re: calling ANT or Depends?
Date Wed, 25 Jun 2008 21:06:09 GMT
Are you putting <ant> calls into your build.xml to call your targets?

You should have something like this:

<target name="init">
   [...]
</target>

<target name="clean">
    [...]
</target>

<target name="compile"
    depends="init">
   [...]
</target>

<target name="sendReport"
    depends="init,compile">
    [...]
</target>

<target name="complete"
   depends="clean sendReport"/>

Running "ant complete" will run "init", "clean", "compile", and
"sendReport" only once. If you call multiple targets on the command
line, or use <ant> tasks, you will get multiple calls because each
target is executed separately.

Note that I only "complete" depending upon "clean". You usually don't
force a "clean" or you break your build dependency checking.

Here's my test build.xml:

<project name="test" default="complete" basedir=".">
    <target name="init"/>
    <target name="clean"/>
    <target name="compile" depends="clean,init"/>
    <target name="sendReport" depends="init,compile"/>
    <target name="complete" depends="init,sendReport"/>
</project>

Try running "ant compile", "ant sendReport" and "ant complete".

--
David Weintraub
qazwart@gmail.com


On Wed, Jun 25, 2008 at 9:38 AM, Guy Catz <Guy.catz@waves.com> wrote:
> I want to run the most trivial build process -
> init, and - clean, compile, sendReport which depend on init.
>
> Now, I've wrote a MAIN target -
> <target name="MAIN">
>    <ant ...     clean />
>    <ant ...     compile />
>
>    <if result is ok, then prepare something>
>
>    <ant ...     sendReport />
> </target>
>
> The problem - init is being called three times.
>
> I know that the best way to do it is <target name="main" depends="init, clean, compile,
sendReport" />
>
> but the problem is that I have to do something between the compile and the sendReport
targets.
>
> how can I accomplish this?
>
> Please advise.
>
> Thanks,
>    Guy.
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message