aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes Passing current directory to Ant script located elsewhere Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Passing current directory to Ant script located elsewhere" Watch "Passing current directory to Ant script located elsewhere" New topic
Author

Passing current directory to Ant script located elsewhere

steve claflin
Ranch Hand

Joined: Dec 04, 2008
Posts: 54
I have an ant script, located in a fixed location that includes a Java class that it runs. I want the Java class to process files in whatever directory I launched ant from (I provide the path to build.xml when I launch it). It seems that the ant's concept of "." is the location of build.xml, so what captures the knowledge of where the command prompt is? (like that ~dp0 thing in a cmd file ...)
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5823
    
    7

Try ${user.dir}


JBoss In Action
steve claflin
Ranch Hand

Joined: Dec 04, 2008
Posts: 54
Works like a charm - thanks!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Passing current directory to Ant script located elsewhere