ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Sunde" <>
Subject is it possible to create targets dynamically?
Date Fri, 16 Jan 2004 21:11:23 GMT
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" />
      <target name="@{name}">
         <echo>@{name} target executed.</echo>
         <!-- the real work goes here. -->
<echoTarget name="dynamic"/>
<target name="all" depends="dynamic"/>

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?

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