ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kyle Adams" <>
Subject RE: Properties, scope and project hierarchies (an answer to the original question)
Date Mon, 09 Jul 2001 12:17:11 GMT
Well, there are several ways of handling <path> structure.  The first
way would be to use the method I outlined in the previous e-mail to specify
multiple path properties:

c:\dev\src\ant -Dproject.dir=com/gfs/common -Djava.lib=c:/jdk1.2.2/lib

  <pathelement path="${java.lib}" />
  <pathelement path="${ant.lib}" />

The paths can then also be passed down (and appended or prepended as needed) from file to


I think that's a pretty bad solution.  In my experience, most <path> structures point
to the same path, no matter where the build file is in your directory tree.  For example,
ant's libraries are always in the same place (c:\ant\lib) and java's libraries are always
in the same place (c:\jdk1.2.2\lib).  Therefore, there's no need to change (append, prepend)
the path as control moves from a parent build file to a child.  In that case, it makes much
more sense to move commonly used libraries and paths into a properties file (usually called

# Properties file
root = c:/

java.lib = ${root}jdk1.2.2/lib/tools.jar
weblogic.lib = ${root}weblogic/lib/weblogic510sp8.jar:${root}weblogic/lib/weblogicaux.jar:

<project name="Some Project" default="build" basedir=".">
  <property file="" />
  <target name="build">
    <javac srcdir="${src.dir}" destdir="${dest.dir}>
        <pathelement path="${java.lib}" />
        <pathelement path="${weblogic.lib}" />

If you have a special need for dynamically constructing multiple paths as you move through
the build process, give more details about the situation and we'll see what ant-user can come
up with.


>>> 07/06/01 02:50PM >>>

Ah. Good. I found this one works for single pathname-valued properties.
Thank you..

Now, for part 2: How do you do something similar for <path> specifications? 


View raw message