ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andy Kriger" <akri...@greaterthanone.com>
Subject RE: Referencing a path id in another build file
Date Fri, 17 Jan 2003 14:55:23 GMT
You could try this...

At the top of your build.xml, use this
<!DOCTYPE project [
    <!ENTITY paths SYSTEM "file:paths.xml">
]>

And then within your build.xml
&paths;

This includes the file paths.xml in the file build.xml
The benefit is that you can isolate common elements and reuse them. The
drawback is that paths.xml must contain fragments (just the path elements
instead of a valid build file with project as its root).


-----Original Message-----
From: Nau, Michael [mailto:Michael.Nau@pyxis.com]
Sent: Friday, January 17, 2003 4:19
To: ant-user@jakarta.apache.org
Subject: Referencing a path id in another build file


Is there a way to reference a path id setup in foo.xml in bar.xml?

For example:

foo.xml
=============================================
<project name="foo" default="" basedir=".">
  <path id="foo.cp">
    <pathelement location="${lib.dir}/j2ee.jar"/>
    <pathelement location="${lib.dir}/junit.jar"/>
  </path>

  <target name="foo">
    <ant antfile="bar.xml" target="print-foo.cp"/>
  </target>
</project>
=============================================

bar.xml
=============================================
<project name="bar" default="" basedir=".">
  <target name="print-foo.cp">
    <pathconvert property="formatted-path" pathsep="${line.separator}
" refid="foo.cp"/>
    <echo message="path = ${formatted-path}"/>
  </target>
</project>
=============================================

output
=============================================
D:\Temp>ant -f foo.xml foo
Buildfile: foo.xml

foo:

print-foo.cp:

BUILD FAILED
file:D:/Temp/bar.xml:3: Reference foo.cp not found.

Total time: 1 second
=============================================

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