You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Mike Cepek <mc...@smsi.com> on 2003/06/24 17:59:53 UTC

Running multiple targets with 'ant' task

Hi,

I would like to invoke a series of targets in another ant script.

I tried the following but it didn't work.  Is there another way to do
this (using only the built-in Ant tasks)?

----- build.xml -----

<project default="foo">
<target name="foo">
  <property name="targTest" value="tt"/>
  <ant antfile="build2.xml" target="${targTest}"/>
  <property name="targSet" value="one two three"/>
  <ant antfile="build2.xml" target="${targSet}"/>
</target>
</project>

----- build2.xml -----

<project default="two">

<target name="tt"> <echo message="test"/> </target>
<target name="one">   <echo message="1"/> </target>
<target name="two">   <echo message="2"/> </target>
<target name="three"> <echo message="3"/> </target>

</project>

----- output -----

Buildfile: build.xml

tt:
     [echo] test

BUILD FAILED
file:build.xml:7: Target `one two three' does not exist in this project.

Total time: 2 seconds

----- [END] -----

This issue was raised previously (and not answered) in this thread:

http://archives.apache.org/eyebrowse/BrowseList?listName=user@ant.apache
.org&by=thread&from=253901

Thank you.


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


RE: Running multiple targets with 'ant' task

Posted by "W. Sean Hennessy" <sh...@goldenhourdata.com>.
Break em out into separate targets with declared dependencies.

<project default="foo">
<target name="foo" depends="foo.bld.1,foo.bld.2"/>
<target name="foo.bld.1" >
  <property name="targTest" value="tt"/>
  <ant antfile="build2.xml" target="${targTest}"/>
</target>
<target name="foo.bld.2" depends="foo.bld.1">
  <property name="targSet" value="one two three"/>
  <ant antfile="build2.xml" target="${targSet}"/>
</target>
</project>

-----Original Message-----
From: Mike Cepek [mailto:mcepek@smsi.com]
Sent: Tuesday, June 24, 2003 9:00 AM
To: Ant Users
Subject: Running multiple targets with 'ant' task


Hi,

I would like to invoke a series of targets in another ant script.

I tried the following but it didn't work.  Is there another way to do
this (using only the built-in Ant tasks)?

----- build.xml -----

<project default="foo">
<target name="foo">
  <property name="targTest" value="tt"/>
  <ant antfile="build2.xml" target="${targTest}"/>
  <property name="targSet" value="one two three"/>
  <ant antfile="build2.xml" target="${targSet}"/>
</target>
</project>

----- build2.xml -----

<project default="two">

<target name="tt"> <echo message="test"/> </target>
<target name="one">   <echo message="1"/> </target>
<target name="two">   <echo message="2"/> </target>
<target name="three"> <echo message="3"/> </target>

</project>

----- output -----

Buildfile: build.xml

tt:
     [echo] test

BUILD FAILED
file:build.xml:7: Target `one two three' does not exist in this project.

Total time: 2 seconds

----- [END] -----

This issue was raised previously (and not answered) in this thread:

http://archives.apache.org/eyebrowse/BrowseList?listName=user@ant.apache
.org&by=thread&from=253901

Thank you.


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




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