ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacob Kjome <>
Subject xmlproperty path issue
Date Tue, 12 Oct 2004 04:58:33 GMT

I'm not 100% sure this is a bug, or just a known limitation of 
<xmlproperty>, but I'll give it a go and see what others think (I'm using 
Ant-1.6.2, btw)...

When I use <xmlproperty> to define a path and include a reference to a path 
that I override later, if that overridden path includes a pathelement using 
a property that hadn't yet been resolved by <xmlproperty> at the time it 
loaded, the path won't be resolved properly.  If, instead, I put the path 
definition directly in the build.xml file, it resolves fine even though, in 
both cases, the property used in the pathelement defintion is defined after 
the original path was defined.  Here's the relevant "ant -verbose" output...

parsing buildfile D:\dev\test\build.xml with URI = 
Project base dir set to: D:\dev\test
[xmlproperty] Loading D:\dev\test\props.xml
Property ${classesdir.local} has not been set
Overriding previous definition of reference to build.classpath.local

Obviously, my compile fails since the classpath isn't properly set.

props.xml looks like...

     <path pathid="build.classpath">
         <path refid="build.classpath.local"/>

build.xml looks like...

<project name="hmmm" default="compile" basedir=".">

     <property name="srcdir"     location="src"/>
     <property name="classesdir" location="classes"/>

     <!--path id="build.classpath">
         <path refid="build.classpath.local"/>

     <property name="srcdir.local"     location="local-src"/>
     <property name="classesdir.local" location="local-classes"/>

     <path id="build.classpath.local">
         <pathelement location="${classesdir.local}" />

     <target name="clean">
         <delete dir="${classesdir}"/>
         <delete dir="${classesdir.local}"/>

     <target name="compile">
         <mkdir dir="${classesdir}"/>
         <mkdir dir="${classesdir.local}"/>
         <!-- srcdir depends on srcdir.local, so this order is important! -->
         <javac srcdir="${srcdir.local}" destdir="${classesdir.local}" 
         <javac srcdir="${srcdir}" destdir="${classesdir}" 
includeAntRuntime="false" classpathref="build.classpath"/>


Try commenting out <xmlproperty> and uncommenting the commented out <path> 
to see how it works when the path is included directly in the build file 
rather than in <xmlproperty>..

Is this a bug or a known limitation of defining paths in 
<xmlproperty>?  BTW, the way to work around this is to define the 
"classesdir.local" property before (or inside) <xmlproperty> or hard code 
the path information rather than using a property.  However, this is kind 
of annoying because this should be transparent to the build file 
writer.  Either both cases should work or both should fail.  My assertion 
is that they both should work.  Am I right?


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message