ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kyle Adams" <kad...@gfs.com>
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
-Dant.lib=c:/ant/lib

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

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

HOWEVER

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
build.properties):

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

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

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.

Kyle

>>> shankar@intruvert.com 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? 

Thanks!
--
Shankar.


Mime
View raw message