ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <>
Subject RE: Asking again: How to echo the target
Date Wed, 09 Apr 2003 13:56:50 GMT
All you can get is the target containing a task, using a script. As stated
by others, you can't get back to the invoked targets, except if you play
around with the wrapper script to intercept them and stick them in a
property. I demonstrated also how to intercept the Ant command line entirely
a few months ago using a Java program, taking advantage of ANT_OPTS (look
for the interceptor or intercept keywords). --DD

  <target name="test">
    <script language="javascript"><![CDATA[
      name = self.getOwningTarget().getName();
      self.getProject().setNewProperty("targetname", name);
    <echo message="current target is '${targetname}'" />

-----Original Message-----
From: scollins [] 
Sent: Monday, April 07, 2003 4:04 PM
To: Ant Users List
Subject: Asking again: How to echo the target

If I invoke ant with 'ant build' with the following build file:

<target name="init" >
<echo message="ant was invoked with target  ${target}"/>

<target name="build" depends="init">

I would like the echo statement to echo the target with with Ant was
invoked.  Namely "build".
How do I do this?   Can't find a built-in property.

Thanks, Steve

View raw message