ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Hempe <>
Subject References do not work for me.
Date Thu, 16 Nov 2000 21:12:25 GMT
References don't act nice like properties, there must be something about
them I'm not "getting".  Are they supposed to be working or is this feature

They don't expand right, and they simply don't work for me.  If the
following file is "test.xml":

<project name="testref" basedir=".">
<target name="init">
  <property name="myprop" value="foo/bar"/>
  <property name="ugly.class.path" value="this:that:the_other"/>

<path id="compile.class.path">
  <pathelement location="/${myprop}/baz"/>
  <pathelement location="/only/hardcoded/paths/work"/>

<target name="list" depends="init">
  <property name="transfer.compile.class.path" refid="compile.class.path"/>
  <echo message="CLASS PATH is ${transfer.compile.class.path}"/>
  <echo message="Ugly class path actually works and is:

My output is as follows:

build >ant -version                                                 
Ant version 1.2 compiled on October 24 2000                         
build >ant -buildfile test.xml list                                 
Buildfile: test.xml                                                 
CLASS PATH is /${myprop}/baz:/only/hardcoded/paths/work             
Ugly class path actually works and is: this:that:the_other          
BUILD SUCCESSFUL                                                    
Total time: 0 seconds                                               

To add insult to injury, when I use a "javac" task in verbose mode, and
specify classpath by reference, I seem to get a class path that has nothing
whatsoever to do with the one I specified.
I'm referencing it correctly I believe:

<target name="compile" depends="init">
  <javac srcdir="path/to/my/classes"
    <classpath refid="compile.class.path"/>

If I use a version of this target with my test script listed above, invoked
with -verbose, I get:
    [javac] Compilation args: -d path/to/my/classes -classpath
-sourcepath [path] -g                                           

This classpath looks a heckuvalot more like the path the Ant sh script uses
to invoke itself than what I referenced, which should be in the worst case
And ideally:

So my first question is, why don't properties in referentially defined paths
seem to expand correctly? 

The second one is, why don't referenced classpaths seem to work AT ALL for

--John Hempe


> -----Original Message-----
> From: Stefan Bodewig []
> Sent: Thursday, November 16, 2000 12:36 AM
> To:
> Subject: Re: Debugging references
> John Hempe <> wrote:
> > So if I define something like:
> > 
> > <path id="compile.class.path">
> >   <pathelement location="${something}/classes"/>
> >   <pathelement location="${something.else}/classes"/>
> > </path> 
> > 
> > How can I "echo" what "compile.class.path" gets set to?  How can I
> > see it at runtime?
> <snip/>
> > I tried <echo message="${compile.class.path}"> but that doesn't
> > work,
> Assign it to a property in between:
> <property name="compile.class.path" refid="compile.class.path" />
> <echo message="${compile.class.path}">
> ugly but it should work.
> Stefan

View raw message