V
vturner
If I define an Ant property and assign it a value, is it possible to change
it later. Something like:
<property name="abc" value="hello"/>
<alter property="abc" newvalue="goodbye"/>
<echo message="${abc}"/> # will print "hello", but want "goodbye"
In general, treat a propertly like a variable. Or are ant properties like
"variables" in XSL -- namely they're really constants?
I know I can write a Taskdef handler (Java program) that does something
like:
this.getProject().setProperty("abc", "goodbye");
However, it seems like there ought to be a built in feature of Ant that
allows this. The closest I can find is the <copyproperty> tag from
ant-conrib. This allows you to copy the value of a property into another,
but only if the "new" property has never been defined. You cannot use it
to override a previously defined property.
My basic problem is I'm calling a sub-project from my main project and I
want to be able to return properties from the sub-project back to the main
project:
<ant antfile="build_child.xml" dir="." target="do-something"/>
....access properties from build_child.xml here
From my experimentation, it appears any properties defined in the
sub-project are not available to the parent project. Properties in the
parent projct *are* available to the sub-project, but since they're already
defined I can't alter them with new values.
So I guess my real question is: how do you pass properties from a subproject
back to the calling project?
it later. Something like:
<property name="abc" value="hello"/>
<alter property="abc" newvalue="goodbye"/>
<echo message="${abc}"/> # will print "hello", but want "goodbye"
In general, treat a propertly like a variable. Or are ant properties like
"variables" in XSL -- namely they're really constants?
I know I can write a Taskdef handler (Java program) that does something
like:
this.getProject().setProperty("abc", "goodbye");
However, it seems like there ought to be a built in feature of Ant that
allows this. The closest I can find is the <copyproperty> tag from
ant-conrib. This allows you to copy the value of a property into another,
but only if the "new" property has never been defined. You cannot use it
to override a previously defined property.
My basic problem is I'm calling a sub-project from my main project and I
want to be able to return properties from the sub-project back to the main
project:
<ant antfile="build_child.xml" dir="." target="do-something"/>
....access properties from build_child.xml here
From my experimentation, it appears any properties defined in the
sub-project are not available to the parent project. Properties in the
parent projct *are* available to the sub-project, but since they're already
defined I can't alter them with new values.
So I guess my real question is: how do you pass properties from a subproject
back to the calling project?