ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ma, Jian" <>
Subject RE: How to run a target without ANTCALL?
Date Fri, 14 Dec 2001 17:57:30 GMT
You can use "if" in your dependents target.  So that it won't be executed
unless certain property is set.  Only define that property when you need to
execute that particular target.

Here's an example:

in build.xml
<project name="inner project">
<target name="init" if="executeInit">

<target name="test" depends="init">
do something here

in ctrl.xml
<project name="control">
<target name="test1">
<ant antfile="build.xml" target="test">
	<property name="executeInit" value="true"/>

<target name="test2">
<ant antfile="build.xml" target="test"/>

In the case of test1, init target will be executed.  While in case of test2,
init target won't be executed.

If you don't want to use two scripts to control it, you can also define
property from command line:

ant -DexecuteInit=true -buildfile build.xml test
ant -buildfile build.xml test

Jian"Chuck" Ma
1620 Montgomery St. Suite 140
San Francisco, CA 94111

-----Original Message-----
From: Mark McMillan []
Sent: Friday, December 14, 2001 9:40 AM
To: Ant Users List
Subject: How to run a target without ANTCALL?

At some point in a target I need to execute some other target in the same 
project, but I don't want to use ANTCALL because it re-evaluates all the 
dependant targets.  E.g. I have an "init" target that all targets depend 
on.  If I use ANTCALL to invoke a target, "init" will be executed more than 
once.  Is there some way to invoke a target without using ANTCALL (or, some 
way to prevent re-evaluation of dependants in the call)?


To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message