ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Eric Wood" <EW...@llbean.com>
Subject RE: Best way to perform this type of conditonal test in ANT
Date Fri, 21 Sep 2007 13:37:00 GMT
Thanks, 

I have created a bunch of targets for PMD that I would like to keep, so
the question is how do I call these targets from the "pmd" target while
still keeping the conditional clause?

I found that if I use antcall (or runtarget like in the code below),
then properties that are set that I want to reference later are
unavailable.  How do I " ... do pmd stuff" by invoking other targets? 

Eric

-----Original Message-----
From: Peter Reilly [mailto:peter.kitt.reilly@gmail.com] 
Sent: Friday, September 21, 2007 9:27 AM
To: Ant Users List
Subject: Re: Best way to perform this type of conditonal test in ANT

Opp, I hit send by accident, (gmail does not have the same key shortcuts
as emacs).
<project>
   <target name="init">
       <available file="lib/pmd.jar" property="pmd.jar"/>
   <target>
   <target name="pmd" depends="init" if="pmd.jar">
     ... do pmd stuff
   <target>
</project>



On 9/21/07, Peter Reilly <peter.kitt.reilly@gmail.com> wrote:
> <project>
>    <target name="init">
>       <available file="lib/pmd.jar" property="pmd.jar"/>
>    <target>
>
>
>
> On 9/21/07, Eric Wood <EWood@llbean.com> wrote:
> > I want to only call a target ( _pmd ) if the property "pmd.jar" is
set.
> >
> >     <target name="perform-pmd" if="pmd.jar" >
> >         <runtarget target="_pmd" />
> >     </target>
> >
> >     <target name="_pmd"
> > depends="pmd-init,find-pmd-java-files,modified-java-pmd,new-java-pmd
> > " />
> >
> >
> > The problem I have with the code above is that runtarget seems to 
> > run in its own JVM so properties that are set in there that I need 
> > to reference later are not available after it runs.  Also, if I add 
> > the "if" clause to the _pmd target, the depends are processed first.
> >
> > How do I best handle the conditional execution of a target without 
> > using either antcall or runtarget?
> >
>

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


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


Mime
View raw message