Try this:
If you want to define a new target or property or classpath
Add this to the top of the build.xml file:
        <!DOCTYPE project  [
                <!ENTITY test-file SYSTEM "testInclude.xml">
        ]>
And then start the project:
        <project name="project" default="all" basedir=".">
And then where you need to include the file:
        &test-file;
And get on with the rest:
        </project>

Alan.


-----Original Message-----
From: Martin Saxer [mailto:[EMAIL PROTECTED]]
Sent: 17 November 2001 01:21
To: [EMAIL PROTECTED]
Subject: Sharing path id across multiple build files. Is it possible?


Hi,

I've searched the mail archives and ant documentation for a couple hours
and haven't found a solution to my problem.  I'm wondering if somebody
has a quick fix that could fix this problem.

Problem statement: I'm using Ant 1.4.  My project has multiple build
files, one of which could be considered the parent build file that calls
the children build files in succession.  The issue is that I need to set
the exact same <path id="classes.path"> element in each of the child
build files.  It'd be nice if this could be centralized as I've done for
all of the project properties/variables.

Here's a subset of what the <path> element looks like:

<path id="classes.path">
        <fileset dir="${thirdparty.dir}" >
                <include name="**/*.jar"/>
        </fileset>
</path>

Is there an easy way to reference this with a refid from another
build.xml?  If so, what is the syntax?

I tried another trick that didn't work - I put the code above inside a
target like so:

<target name="setclasspath" description="Sets classpath for project
build">
        <path id="classes.path">
                <fileset dir="${thirdparty.dir}" >
                        <include name="**/*.jar"/>
                </fileset>
        </path>
</target>

In the child build file I added:

<target name="setclasspath">
        <ant antfile="build.xml" dir="../parent" target="setclasspath"/>
</target>

Unfortunately, classes.path can't be used as a refid like this.

So...any other ideas I can try?

Thanks,
Martin


--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to