In my tomcat project I have a configuration folder, in path src/main/tomcatconf.
Now I want to deploy to 2 different servers. A development server and a production one.
I run my development server with mvn tomcat:run. Running my server on the fly, and all work perfectly.
Now I want to add the production server, with a different configuration folder (ie src/main/production/tomcatconf) and deploy the .war on Tomcat instance in my filesystem (ie /opt/tomcat6)
with mvn tomcat:deploy command.
How can i do this ?
Finally i used maven resource plugin with profile configuration.
i’ve made two additional folder :
src/main/production
src/main/development,
then i move my Meta-inf/persistence.xml in these folder.
then i add this part of configuration on my pom.xml :
in this manner i’ve a common resource folder and an additional folder based by environment type.
Now when i run
mvn tomcat:run -Denvironment.type=devi use my development environment and when i run
mvn tomcat:run -Denvironment.type=prodi use my production enviroment.
The only drawback of this approach is that everytime i want change environment type i must run
mvn cleanto build the right configuration file.Please let me know If you Think that i wrong or you want suggest another kind of solution
Regards
Antonio Musella