ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Diane Holt <hol...@yahoo.com>
Subject Re: Property propagation?
Date Tue, 24 Oct 2000 17:54:21 GMT
I might be too sleep-deprived to be answering this correctly, but I think
you should be including a nested <property> in your <ant> calls, in order
to pass to the "clean" target's "myprop" the value you want. Ie:
<ant antfile="test.xml" target="clean">
  <property name="myprop" value="${myprop}"/>
</ant>

Diane

--- Stuart Halloway <stu@develop.com> wrote:
> According to the docs, properties are propagated by the "ant" task, and
> override any "property" task settings.  I am not finding this to be the
> case, e.g.
> 
> <project name="test" default="all" basedir=".">
>   <target name="clean">
>     <property name="myprop" value="other" />
>     <echo message="clean ran, myprop=${myprop}"/>
>   </target>
>   <target name="compile">
>     <echo message="compile ran, myprop=${myprop}"/>
>   </target>
>   <target name="all">
>     <echo message="all ran, myprop=${myprop}"/>
>     <ant antfile="test.xml" target="clean"/>
>     <ant antfile="test.xml" target="compile"/>
>   </target>
> </project>
> 
> The idea of this project is that "all" depends on "clean" followed by
> "compile," BUT "compile" does not depend on "clean."  To make this work,
> I
> execute "clean" and "compile" as "ant" tasks under the "all" target.
> 
> Properties passed on the command line correctly propagate to the ant
> sub-tasks, but then the "property" task is able to change them.  So,
> with
> the command line
> 
> 	ant -buildfile=test.xml -Dmyprop=foo all
> 
> the "all" task correctly uses the value "foo" but the "clean" task uses
> the
> value "other."  As a workaround, I can pass the properties explicitly,
> like
> this:
> 
> <ant antfile="test.xml" target="clean">
>   <property name="myprop" value="${myprop}" />
> </ant>
> 
> Is this an ant bug, a stu bug, or a doc error?  :-)
> 
> Stuart Halloway
> DevelopMentor
> http://staff.develop.com/halloway
> 


=====
(holtdl@yahoo.com)



__________________________________________________
Do You Yahoo!?
Yahoo! Messenger - Talk while you surf!  It's FREE.
http://im.yahoo.com/

Mime
View raw message