Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Sharing properties file between ant and java

 
marten kay
Ranch Hand
Posts: 178
Java jQuery Postgres Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Jelle Klap
Bartender
Posts: 1951
7
Eclipse IDE Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
marten kay
Ranch Hand
Posts: 178
Java jQuery Postgres Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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



 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic