You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Miroslav Nachev <m....@prosyst.bg> on 2008/09/03 15:46:26 UTC
How to set Current Working Directory (CWD) from Java application
Hi,
I need to start ANT from one OSGi Bundle in concurrent mode. The build
xml files are passed as parameters to startAnt method of
org.apache.tools.ant.Main.
The first problem in that approach is that the current working directory
(System.getProperty("user.dir")) must be different for each startAnt
call. I need of that because the base directory in XML file in most of
the cases is set relatively like ".", "..", "../x", etc.
The second problem is when I set the CWD using
System.getProperties().put("user.dir", newBaseDir) the File instance use
the original CWD instead of the new value.
Do you have any idea how can I solve that? The smart way is if ANT
implementation have helper method for CWD like
getCurrentWorkingDirectory(). To solve the File problem new AntFile
class which extends java.io.File can be used. Then this new AntFile
class will check in the constructors for strings which starts with "."
or ".." and will replace the value with instance CWD.
Regards,
Miro.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org