ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ma, Jian" <Jian...@kmv.com>
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>

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


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

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

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
versus
ant -buildfile build.xml test


Jian"Chuck" Ma
KMV LLC
1620 Montgomery St. Suite 140
San Francisco, CA 94111
415-352-1157(w)




-----Original Message-----
From: Mark McMillan [mailto:mark.mcmillan@engineous.com]
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)?

Thanks,
-Mark


--
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