This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Ant, Maven and Other Build Tools and the fly likes Reading a property file taking the key and searching key another property file replace the value Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Reading a property file taking the key and searching key another property file replace the value " Watch "Reading a property file taking the key and searching key another property file replace the value " New topic
Author

Reading a property file taking the key and searching key another property file replace the value

yatheesha jagadeesha
Greenhorn

Joined: Jun 10, 2013
Posts: 1
reading a property file taking the key and searching key another property file replace the value of key using maven

propertyfile1.properties

key1=someValueforkey1

propertyfile2.properties

key1=defaultvalue

while building it should replace the key1 value defaultvalue in propertyfile2.properties should be replaced with someValueforkey1 of propertyfile1.properties.

..Can any one help me out to solve this
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5823
    
    7

Read up on how Maven handles properties, how you can use profiles, and how the Resources Plugin does property replacement.

My standard practice is to use property references in the properties file (or XML file), such as:



Then in the POM I provide a default value for the property (the default value I use is always hte value used in production), and I tell the Resources Plugin to filter resources:



I can supply a different default by providing a profile with this property in my settings.xml file:



On my PC the resulting properties file will have:

key1=myKey1Value

On the Jenkins build slave the properties file will have:

key1=someValueForKey1

I can even change the value dynamically on the command line:

mvn clean package -Dkey1.value=useThisInstead

JBoss In Action
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Reading a property file taking the key and searching key another property file replace the value