My requirments are as follow :
– we are having four environments(dev,uat,prod,stag)
– currently we are having 5 property files(log4j.properties for example) one for each
environment like : log4j_dev.properties, log4j_uat.properties, log4j_prod.properties, log4j_stag.properties
– all the above files have most of the things in common, just some 4 to 5 properties are different in each file.
my current requirments is that we have to put all the properites in a common file(log4j.properties for example ) and the environment specific file would contain only
the specific 4 to 5 property . during build time these files should be merged and a new file should be created containing all these properties .
I tried maven-config-processor-plugin thats working fine with mavne 2 , but its not compatible with maven3 . Currently we are using maven3 so i need some alternative approach .
Is there any alternative to maven config-processor or i need to write some new maven plugin for doing so .
Any suggestions plz .
Have you tried to use maven-resources-plugin and the filtering option on resources
Here is an example :
Then you have a directory src/main/filters. For each of your environment you add a filter_env.properties.
In it, you put your key you want to variabilize, like this
And finally, in your properties file, you add variables instead of real values. The plugin will replace values with the filters ones :