barf barf wrote:
I am attempting to make use of the property deferencing trick described
in "Java Development with Ant", and am seeing something odd. Here's a
short example:
<project name="test" basedir=".">
<tstamp>
<format property="${ant.project.name}.STARTTIME"
pattern="MM/dd/yyyy hh:mm aa"
id="ts"/>
</tstamp>
<property name="project.ts" refid="ts"/>
<echo message="${project.ts}"/>
</project>
produces the following output with ant 1.6.5:
Buildfile: build.xml
[echo] [EMAIL PROTECTED]
BUILD SUCCESSFUL
I realize that 'id' is not listed as an attribute for the format
element, I just tried it to see if it
might work. I would have expected an error rather than what I got.
id is a secret attribute that anything can have.
So, that said, anyone have a mean with ant along to set the tstamp
property based on some other
property and then be able to access it ?
You are trying to set the name of the target property dynamically? Yes,
that works. The hard thing is reading it back, because you can't go
<echo>${${ant.project.name}.STARTTIME}</echo>.
There is an ant-contrib task that can do that kind of double-dereference.
-steve
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]