ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shackelford, John-Mason" <Sha...@ncs.com>
Subject RE: Overload?!
Date Tue, 17 Sep 2002 14:10:05 GMT
Christian,

You are on the right track. The only reason you have a problem is that you
include the target twice in build1.xml and build2.xml. 

I use a similar approach to manage build files for a project with multiple
versions. Use one entity (your include.xml) for targets common across
versions and another set of entities for the targets that are version
specific. Then write a build-1.xml and build-2.xml, build-3.xml, etc.for
each version doing two entity includes in each: one for common targets, and
another for version specific targets. You can then launch ant using the
-buildfile option or write your own ant runner to make the switch for you on
the basis of a property file. (I have enclosed an example.) 

John-Mason Shackelford

Software Developer
NCS Pearson - Measurement Services
2510 North Dodge St.
Iowa City, IA 52245
319-354-9200x6214
shacjo@ncs.com



-----Original Message-----
From: Christian Holmqvist, IT, Posten [mailto:christian.holmqvist@posten.se]

Sent: Tuesday, September 17, 2002 4:53 AM
To: 'Ant Users List'
Subject: Overload?!


Hi

My situation is that I have made a include.xml file with a number of targets
that is correct for 95% of our projects. The problem is the last 5%.

So my question is: Is there any way to overload a target with Ant?

This is how I would like it to work:

---- include.xml --------

<target name="compile">
	<echo message="foo"/>
</target>

---- build.xml ----

<!DOCTYPE project [
    <!ENTITY include SYSTEM "file:./include.xml">
]>

<project name="test" default="compile" basedir=".">
	&include;
</project>
<!-- in this file the compile in include.xml will be executed -->

----- build1.xml -----

<!DOCTYPE project [
    <!ENTITY include SYSTEM "file:./include.xml">
]>

<project name="test" default="compile" basedir=".">
	&include;

	<target name="compile">
		<echo message="bar"/>
	</target>
</project>
<!-- in this file the compile in include.xml will be executed -->

------- build2.xml --------------
<!DOCTYPE project [
    <!ENTITY include SYSTEM "file:./include.xml">
]>

<project name="test" default="compile" basedir=".">
	<target name="compile"
		<echo message="bar"/>
	</target>

	&include;
</project>
<!-- in this file the compile in build2.xml will be executed -->
--------------------------------------

When this is done today ant tells med that compile is duplicated (or
something like that).

Is there a way around this??

Thanks for your time!

Cheers Christian


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


**************************************************************************** 
This email may contain confidential material. 
If you were not an intended recipient, 
Please notify the sender and delete all copies. 
We may monitor email to and from our network. 
****************************************************************************

Mime
View raw message