I am using the tomcat7-maven-plugin to deploy my application to Tomcat. In my pom.xml I currently have the following information
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<server>test</server>
<path>/api</path>
<update>true</update>
<url>http://XXX.XXX.XX.XX:8080/manager/text</url>
</configuration>
</plugin>
And in ~/.m2/settings.xml I have the following
<settings>
<servers>
<server>
<id>test</id>
<username>*******</username>
<password>*******</password>
</server>
<server>
<id>production</id>
<username>*********</username>
<password>*********</password>
</server>
</servers>
</settings>
My hope is to be able to be able to include selection of the server by ID as part of my command line, e.g.
mvn tomcat7:redeploy -Dserver=production
and have appropriate configuration information from the settings.xml file be used. In addition to selecting the specific username and password for deployment, this would also mean moving the URL out of the pom.xml into a separate location.
This post talks about storing the server URL outside of the POM, and seems to indicates there's a way to do this part using some properties files, but doesn't expand on where those files should be located, nor how to specify them on the command line.
Is it possible to do what I'm looking for? Or am I stuck editing the pom.xml file each time that I want to choose a different server to deploy to?