File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Ant, Maven and Other Build Tools and the fly likes Defining Ant build.xml java properties files for a run targer 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 "Defining Ant build.xml java properties files for a run targer " Watch "Defining Ant build.xml java properties files for a run targer " New topic
Author

Defining Ant build.xml java properties files for a run targer

Miles Davenport
Greenhorn

Joined: Oct 07, 2009
Posts: 1
I am writing a build.xml file for a standalone java class which uses five ???.properties files. I need to know how to define these within build.xml.

I have tried a number of combinations, and get a file not found exception (from MyClass for the run target).

I have tried:


<path id ="loadVals">
<fileset dir="../properties">
<include name="*.properties"/>
</fileset>
</path>

AND:

<property file="../properties/log4j.properties"/>
<property file="../properties/one.properties"/>
<property file="../properties/two.properties"/>
<property file="../properties/three.properties"/>
<property file="../properties/four.properties"/>

------



Can someone please tell me how to define the five properties files. Thank you (please find build.xml below).



Miles.




David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Please use code tags; without them code and configs are essentially impossible to read.

If you're talking about referencing the files during run time it depends on how you're accessing the files. If you're reading them in as resources they need to be on the classpath of the program itself. The property file tag in an Ant file is for defining *Ant* properties. If you're reading them in as files then you need to reference the actual file path from the standpoint of the executing program.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Defining Ant build.xml java properties files for a run targer