File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Ant, Maven and Other Build Tools and the fly likes referencing folders from within build.xml Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "referencing folders from within build.xml" Watch "referencing folders from within build.xml" New topic

referencing folders from within build.xml

Jan Groth
Ranch Hand

Joined: Feb 03, 2004
Posts: 456

my application is reading a config file. it's located in a subfolder named "config":

1. if i compile & run a test class from within my ide, i have no problems reading the file and setting the properties.

2. if i use a ant task for running the same test, my property reader throws a FileNotFoundException. if i set the path like shown in next line, it works.

looking into the build.xml, it seems to me like if ant is referencing relative to the testbuild directory. obviously that's not what i want... :-(

does anyone have an idea about changing this behaviour in ant?

many thanks in advance,
Andy Hahn
Ranch Hand

Joined: Aug 31, 2004
Posts: 225
Ant will always reference files from the path relative to where ant is executed from.

Have you tried using an absolute path, such as "c:\_development\java\projects\certification" ?
I agree. Here's the link:
subject: referencing folders from within build.xml