I have a question about attribute expansion for macrodefs...
Consider the following:
<project>
<property name = "myMessage1" value = "Name1 [...@{name}] value1 =
[...@{value}]"/>
<property file = "build.properties"/>
<macrodef name = "testOutput">
<attribute name = "name"/>
<attribute name = "value"/>
<sequential>
<property name = "myMessage2" value = "Name2
[...@{name}] value2 = [...@{value}]"/>
<property name = "myMessage4" value =
"${myMessage1}"/>
<echo message = "1: ${myMessage1}"/>
<echo message = "2: ${myMessage2}"/>
<echo message = "3: Name3 [...@{name}] value3 =
[...@{value}]"/>
<echo message = "4: ${myMessage4}"/>
<echo message = "5: ${myMessage5}"/>
</sequential>
</macrodef>
<testOutput name = "foo" value = "bar"/>
</project>
build.properties:
myMessage5=Name5 [...@{name}] value5 = [...@{value}]
When run:
Buildfile: build.xml
[echo] 1: Name1 [...@{name}] value1 = [...@{value}]
[echo] 2: Name2 [foo] value2 = [bar]
[echo] 3: Name3 [foo] value3 = [bar]
[echo] 4: Name1 [...@{name}] value1 = [...@{value}]
[echo] 5: Name5 [...@{name}] value5 = [...@{value}]
I was "hoping" for myMessage1, myMessage4 and myMessage5 to be expanded
based upon the attributes in testOutput.
The reason I am doing this, is I have some macrodef's and am
internationalizing messages/error messages - some of which include the
attributes in the messages.
Is there a way to force expansion "at the right time?"
Or, perhaps, is there a better way to do this sort of thing in Ant? I'm
not opposed to scripting this in beanshell if need be.
Any help, pointers, or hints is GRATELY appreciated!
Scot P. Floess
27 Lake Royale
Louisburg, NC 27549
252-478-8087 (Home)
919-890-8117 (Work)
Chief Architect JPlate http://sourceforge.net/projects/jplate
Chief Architect JavaPIM http://sourceforge.net/projects/javapim
Architect Keros http://sourceforge.net/projects/keros
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]