ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <DDevie...@lgc.com>
Subject RE: How do I specify multiple Windows directories in one <propert y name> statement?
Date Mon, 06 May 2002 20:59:23 GMT
I missed a few episodes of this saga, but here's an illustration that
hopefully will drive the point home.

Look at this tiny project, and see how it compiles fine when called from
P:\org_apache\antx\acme, or P:\org_apache\antx\acme\build, or finally
P:\org_apache\antx. In all cases, the src and classes properties point to
the valid directories (P:\org_apache\antx\acme\src and
P:\org_apache\antx\acme\classes). If the paths stored in the src / classes
properties were relative to the current directory (like in a Windows cmd
session, or *nix shell session), 2 of the 3 build commands should have
failed. The point is that these two paths are relative to the project's
'basedir' attribute, itself being relative to the actual location in the
filesystem of the build.xml file ant parses.

When you start ant, it knows where it is (the current dir).
You passed it the path, relative or absolute, to the build.xml file, so it
knows where that one is (absolutely).
It can thus deduce the absolute path corresponding to the project basedir,
in this case P:\org_apache\antx\acme (since basedir=".." of build file
P:\org_apache\antx\acme\build\build.xml).

Now I'm gonna read Diane's answer ;-) --DD

-----------

P:\org_apache\antx\acme>dir /S /B
P:\org_apache\antx\acme\build
P:\org_apache\antx\acme\classes
P:\org_apache\antx\acme\src
P:\org_apache\antx\acme\build\basedir.xml
P:\org_apache\antx\acme\src\HelloWorld.java

P:\org_apache\antx\acme>type build\basedir.xml
<?xml version="1.0"?>

<project name="acme" default="compile" basedir="..">
  <property name="src" location="src" />
  <property name="classes" location="classes" />

  <target name="compile">
    <javac srcdir="${src}" destdir="${classes}" />
  </target>
</project>

P:\org_apache\antx\acme>type src\HelloWorld.java
public class HelloWorld {
  public static void main(String[] args) {
    System.out.println("Hello World!");
  }
}

P:\org_apache\antx\acme>ant -f build\basedir.xml
Buildfile: build\basedir.xml

compile:
    [javac] Compiling 1 source file to P:\org_apache\antx\acme\classes

BUILD SUCCESSFUL

Total time: 6 seconds
P:\org_apache\antx\acme>dir /S /B
P:\org_apache\antx\acme\build
P:\org_apache\antx\acme\classes
P:\org_apache\antx\acme\src
P:\org_apache\antx\acme\build\basedir.xml
P:\org_apache\antx\acme\classes\HelloWorld.class
P:\org_apache\antx\acme\src\HelloWorld.java

P:\org_apache\antx\acme>del classes\HelloWorld.class

P:\org_apache\antx\acme>cd build

P:\org_apache\antx\acme\build>ant -f basedir.xml
Buildfile: basedir.xml

compile:
    [javac] Compiling 1 source file to P:\org_apache\antx\acme\classes

BUILD SUCCESSFUL

Total time: 1 second
P:\org_apache\antx\acme\build>dir /S /B
P:\org_apache\antx\acme\build\basedir.xml

P:\org_apache\antx\acme\build>dir /S /B ..
P:\org_apache\antx\acme\build
P:\org_apache\antx\acme\classes
P:\org_apache\antx\acme\src
P:\org_apache\antx\acme\build\basedir.xml
P:\org_apache\antx\acme\classes\HelloWorld.class
P:\org_apache\antx\acme\src\HelloWorld.java

P:\org_apache\antx\acme\build>del ..\classes\HelloWorld.class

P:\org_apache\antx\acme\build>cd ..

P:\org_apache\antx\acme>cd ..

P:\org_apache\antx>ant -f acme\build\basedir.xml
Buildfile: acme\build\basedir.xml

compile:
    [javac] Compiling 1 source file to P:\org_apache\antx\acme\classes

BUILD SUCCESSFUL

Total time: 1 second
P:\org_apache\antx>dir /S /B acme
P:\org_apache\antx\acme\build
P:\org_apache\antx\acme\classes
P:\org_apache\antx\acme\src
P:\org_apache\antx\acme\build\basedir.xml
P:\org_apache\antx\acme\classes\HelloWorld.class
P:\org_apache\antx\acme\src\HelloWorld.java

P:\org_apache\antx>

-----Original Message-----
From: Daniel Barclay [mailto:dbarclay@mercator.com] 
Sent: Monday, May 06, 2002 2:30 PM
To: Ant Users List
Subject: RE: How do I specify multiple Windows directories in one <propert y
name> statement?



> From: Diane Holt [mailto:holtdl@yahoo.com]

I never meant for this to drag out for so long, but let me try
one more increment.  Maybe we can identity where our understandings
of the meaning of "relative" diverge.  (It might be in Windows vs.
in Ant.)

on and on it goes...

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