ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Sunde" <msu...@actional.com>
Subject is it possible to create targets dynamically?
Date Fri, 16 Jan 2004 21:11:23 GMT
Hi,
 
When looking at my build.xml file, there are several targets that are almost identical. The
main difference between them is the name of the target and a path. Is it possible to create
a target dynamically. I tried using macrodef in ant 1.6 but that did not work:
 
<project name="test" default="all" basedir=".">
<macrodef name="echoTarget">
   <attribute name="name" />
   <sequential>
      <target name="@{name}">
         <echo>@{name} target executed.</echo>
         <!-- the real work goes here. -->
      </target>
   </sequential>
</macrodef>
<echoTarget name="dynamic"/>
<target name="all" depends="dynamic"/>
</project>

Error:
E:\builds\build.xml:11: Following error occured while executing this line
E:\builds\build.xml:5: Could not create task or type of type: target.
 
>From the command line, I would like to be able to do:
   ant dynamic
 
The only way I can think of doing it is to run an xslt on the build file to generate all the
targets. Is there another cleaner/simpler solution?
 
Thanks,
Michael
 

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message