You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Grinvald, Edward" <ED...@ca.com> on 2002/06/12 18:15:58 UTC
Property Precedence
Hello,
could somebody please explain to me what is the precedence of
properties in a project:
+ set in build.xml
+ specified with -D at prompt
+ from the properties file
+ is there a difference between setting a property in the xml, or calling
.setProperty() from a <script>.
Thank You,
Edward Grinvald
Computer Associates International
Programmer, Storage Development
Edward.Grinvald@ca.com
1-631-342-6000 x76350
-----Original Message-----
From: Marc Logemann [mailto:devlists@logemann.info]
Sent: Wednesday, June 12, 2002 11:36 AM
To: ant-user@jakarta.apache.org
Subject: Re: parsing a task output for further processing
> If you're running Ant1.5, and assuming <tclist> has an option to write
> its output to a file (which, if it doesn't, would definitely be bad,
> but I suppose you could work around it in the meantime by bracketing
> your <tclist> in a <record>):
> <property name="app" value="maxbahr"/>
> <target name="stopApp" depends="chkAppStatus" if="app.running">
> <echo>Stopping ${app}...</echo>
> <tcstop url="${catalina.url}" username="${catalina.username}"
> password="${catalina.password}" path="/${app}"/>
> </target>
> <target name="chkAppStatus">
> <loadfile property="app.running" srcFile="tclist.out">
> <filterchain>
> <linecontains>
> <contains value="/${app}:running"/>
> </linecontains>
> </filterchain>
> </loadfile>
> </target>
Diane, thx for this great solution. It seems i ve missed some important
commands in Ant like <loadfile> or <filterchain>.
Cause tclist cant output to file (IMO) i will also look up your mentioned
<record> command.
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Property Precedence
Posted by Stefan Bodewig <bo...@apache.org>.
On Wed, 12 Jun 2002, Edward Grinvald <ED...@ca.com> wrote:
> Hello, could somebody please explain to me what is the precedence of
> properties in a project:
> + set in build.xml
> + specified with -D at prompt
-D wins over <property>.
The first <property> wins over a second one setting a property of the
same name.
> + from the properties file
Not sure what you mean here. <property file="..." />? This has the
same precedence as <property name="..." /> repeated for all properties
in that file.
> + is there a difference between setting a property in the xml, or
> calling .setProperty() from a <script>.
Yes. <property> will not overwrite existing properties. setProperty
will. Use setNewProperty to get the same behavior in scripts anf
<property>.
Stefan
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>