Here's an example from Mark Hewitt that works.
It uses relative pathing to get to the common XMl files though.
I've been searching for a way to use an environment variable to specify
the path. Some how get the parser to dereference %COMMON_FILES%/common.xml.
No luck so far.
Mark Hewitt <[EMAIL PROTECTED]> wrote:
I have per-project and shared xml files to achieve this.
The project build.xml has pieces like this:
...
<!-- Include standard entities
-->
<!DOCTYPE project [
<!ENTITY commonProperties SYSTEM "../admin/common.xml">
<!ENTITY projectProperties SYSTEM "project.xml">
<!ENTITY commonTargets SYSTEM "../admin/targets.xml">
]>
<!-- Start of project build description
-->
<project name="XXX" default="compile" basedir=".">
...
<!-- ======================================================================
-->
<!-- Import all the common build targets
-->
<!-- ======================================================================
-->
&commonTargets;
<!-- ======================================================================
-->
<!-- inclusion : Import all the common and project-specific properties
-->
<!-- ======================================================================
-->
<target name="inclusion">
&commonProperties;
&projectProperties;
</target>
Which all works nicely for me!
#!/mjh
-----Original Message-----
From: Danil Suits [mailto:[EMAIL PROTECTED]]
Sent: 28 March 2001 20:30
To: '[EMAIL PROTECTED]'
Subject: Build.xml and reuse
Has anyone experimented with reusing the targets within the build.xml file?
I frequently find myself wanting to work on only a subsystem of the project.
I could add a new target to the build.xml file - but that publishes my local
work to every developers machine, which isn't appropriate in this case.
What I'm currently considering is moving the contents of the project to a
new file (common.xml), replacing them in build.xml with an XML include, then
creating mybuild.xml which includes common.xml, plus whatever other changes
I need. build.xml remains under source control, as does common.xml, but
mybuild.xml is not under control.
I'm sure this will work, and I'm also sure that it is kind of clumsy - has
anybody discovered a better way to achieve target reuse?
Thanks,
Danil
-----Original Message-----
From: Liu, Kenneth Albert (Kenneth)** CTR ** [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 11, 2001 4:14 PM
To: [EMAIL PROTECTED]
Subject: How do I include common targets from an external file?
Hi all -
What I have is several projects which have the same structure and many
similar targets. What I would like to do is factor all these similar
targets into a common.xml file and include that into my build files.
Any ideas on how to do this? I tried searching the archives, but I can't
find a definitive answer.
Thanks.
Ken