I have to create test war and production war, which will have a different log4j.properties
file in the WEB-INF
directory. I have these files log4j.properties
(test war) and dev.log4j.properties
(for production enivorment).
How to copy the dev.log4j.properties
file into log4j.properties
file for production war?
I solved this using the maven-resources plugin, where i created the prod directory which has the resources for production environment and copied them to WEB-INF/classes directory in process-resources phase.
Create a "dev" and "prod" profile, selecting an alternate set of resources for each profile. Make Dev active by default.
Build using the desired profile via:
mvn install -Pdev
ormvn install -Pprod
The code above didn't work for me - had to change it to the following:
Last response is working. But you need to give the version to make it work.
The alternative way is to use maven-antrun-plugin
Assume resource files are in following structure:
When do maven build, run the following commands per environment: