From: "Dan Lipofsky" <[EMAIL PROTECTED]>

> If I want to make targets A and C but not B, and they all depend on
> X, then I end up running X twice if I do "ant A C".


Try this:
<project ...>
 <target name="X" unless="Xcalled">
    <echo message="Hi X"/>
    <property name="Xcalled" value="true"/>
 </target>
 <target name="A" depends="X">
    <echo message="Hi A"/>
 </target>
 <target name="B" depends="super">
    <echo message="Hi B"/>
 </target>
 <target name="C" depends="super">
    <echo message="Hi C"/>
 </target>
</project>

and invoke ant A C now: "Hi X" will be printed just once.

>
> OR
>
> If I want to make targets D and E, but I forget that E already depends on
D,
> and I type "ant D E", I end up running D twice.
>
> To avoid the later problem the user could memorize every dependency
> in the XML file:  Does not sound like a good idea.
>

The above example would work for this too?

Just make sure the property Xcalled is not defined
earlier than in the target X.

Cheers,
Magesh



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to