How can an ANT task like this one:
<target name="mytask">
<echo>processing ${blabla}</echo>
</target>
print processing mytask
?
What should I replace blabla
with ? Or this is actually even possible ?
This might work for you with vanilla Ant, if your version is recent enough to include javascript support.
<scriptdef name="currenttarget" language="javascript">
<attribute name="property"/>
<![CDATA[
importClass( java.lang.Thread );
project.setProperty(
attributes.get( "property" ),
project.getThreadTask(
Thread.currentThread( ) ).getTask( ).getOwningTarget( ).getName( ) );
]]>
</scriptdef>
<target name="foobar">
<currenttarget property="my_target" />
<echo message="${my_target}" />
</target>
The scriptdef
sets up a task currenttarget
that can be used to get the current target in a property, which you can then use as you see fit.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With