<macrodef name="sample">Property can be set only once, and later nobody can change its value. It is good behaviour,
<sequential>
<java resultproperty="java.result">
</sequential>
</macrodef>
elsewere we can run into troubles depends on order of target calls.
So, if we call the above macro second time, the value of ${java.result} stays unchanged.
But we can overcome this:
<macrodef name="sample">That macro can be called more than one time, and will be works correctly.
<attribute name="workDir">
<sequential>
<antcall target="internal.java">
<param name="dir" value="@{workDir}">
</antcall>
</sequential>
</macrodef>
<target name="internal.java">
<java dir="${dir}" resultproperty="java.result"/>
</target>
No comments:
Post a Comment