*
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


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
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!
 
jQuery in Action, 2nd edition
 
subject: Passing current directory to Ant script located elsewhere