ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 45739] Problems with BaseDir when the ant is started as Java library from Java Application
Date Fri, 05 Sep 2008 08:18:16 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=45739





--- Comment #7 from Stefan Bodewig <bodewig@apache.org>  2008-09-05 01:18:15 PST ---
Let's see.

Test.java is

import org.apache.tools.ant.Main;

public class Test {
    public static void main(String[] args) throws Exception {
        System.out.println("user.dir is " + System.getProperty("user.dir"));
        System.out.println("args[0] is " + args[0]);
        new Main().startAnt(new String[] {"-f", args[0]}, null, null);
    }
}

x.xml is

<project basedir=".">
  <echo>${user.dir}</echo>
  <echo>${basedir}</echo>
</project>

C:\Temp>c:\j2sdk1.4.2_18\bin\java.exe -classpath
..\OSS\ant\build\lib\ant.jar;..
\OSS\ant\build\lib\ant-launcher.jar;. Test x.xml
user.dir is C:\Temp
args[0] is x.xml
Buildfile: C:\Temp\x.xml
     [echo] C:\Temp
     [echo] C:\Temp

BUILD SUCCESSFUL
Total time: 0 seconds

C:\Temp>copy x.xml ..
        1 Datei(en) kopiert.

C:\Temp>c:\j2sdk1.4.2_18\bin\java.exe -classpath
..\OSS\ant\build\lib\ant.jar;..
\OSS\ant\build\lib\ant-launcher.jar;. Test ..\x.xml
user.dir is C:\Temp
args[0] is ..\x.xml
Buildfile: C:\x.xml
     [echo] C:\Temp
     [echo] C:\

BUILD SUCCESSFUL
Total time: 0 seconds

so basedir is the directory of the build file and not the current working
directory in my case.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

Mime
View raw message