permaculture playing cards*
The moose likes Ant, Maven and Other Build Tools and the fly likes Sharing properties file between ant and java 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 "Sharing properties file between ant and java" Watch "Sharing properties file between ant and java" New topic
Author

Sharing properties file between ant and java

marten kay
Ranch Hand

Joined: Feb 03, 2007
Posts: 178

Hi

forward referencing can be used in Ant property files so that

is translated by Ant into effectively


Is there a class in Java that will read the properties files in the same way?

This would allow me to share internal file structures between the web-app and the Ant build and deploy

Thanks

Marten


when in doubt put it in parenthesis and stick a dollar sign in front of it, only good can come from this.
Jelle Klap
Bartender

Joined: Mar 10, 2008
Posts: 1753
    
    7

It's called variable interpolation, and the standard Properties mechanism doesn't support it. There are however third-party libraries that do. I'm pretty sure Apache Commons Configuration does, but you should have a look at the documentation to be sure.


Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.
marten kay
Ranch Hand

Joined: Feb 03, 2007
Posts: 178

Thanks Jelle

That worked a treat. I implemented as below. Note that the Apache Commons Configurations resource has some dependency considerations discussed here

Much appreciated.

Cheers



 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Sharing properties file between ant and java
 
Similar Threads
Howto run specific JUnit tests in ant?
How to run "mvn install" from within the ant script?
Hibernate SchemaExportTask Problem
prereq.classpath ?
Spring : DefaultAnnotationHandlerMapping not mapping URL using annotation