ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <DDevie...@lgc.com>
Subject RE: Reading target name
Date Sat, 20 Jul 2002 01:48:58 GMT
You'll need to drop js.jar and bsf.jar in ${ant.home}/lib for the following
to work. See
http://jakarta.apache.org/ant/manual/install.html#librarydependencies for
links on getting the two necessary jars. --DD

P:\org_apache\antx>C:\pro\ant1.5\bin\ant -buildfile targetname.xml
Buildfile: targetname.xml

test:
     [echo] current target is 'test'

BUILD SUCCESSFUL
Total time: 1 second
P:\org_apache\antx>type targetname.xml
<?xml version="1.0"?>

<!-- ANT build file to test a specific feature or bug of ANT.
     Dominique Devienne <ddevienne@lgc.com>        July 2002
  -->
<project name="targetname" default="test" basedir=".">

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

</project>

P:\org_apache\antx>

-----Original Message-----
From: Dan Baumbach [mailto:DBaumbach@ebrut.com] 
Sent: Friday, July 19, 2002 1:35 PM
To: 'ant-user@jakarta.apache.org'
Subject: Reading target name

Is there a way to read the target name?
Example:
<target name="Account">
    <ant antfile="buildEJB.xml">
      <property name="EJB" value="Account"/>
    </ant>
</target>
In the property element, I would like to simply refer to the target name
instead of having to type "Account" in again.

Thanks.
Dan

--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>

--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message