I'm working on some open-source project and wouldn't like to keep URL of production servers in public repository with source code, but at the same time I'd like to have an opportunity to deploy using tomcat-maven-plugin.
I tried to move server url from pom.xml to settings.xml, but it didn't work. Could You please give me a hint, what is the best way to keep url out of pom.xml?
Thank You very much.
Here is my configuration: settings.xml
<settings>
<servers>
<server>
<id>prod</id>
<username>deployer</username>
<password>********</password>
</server>
</servers>
</settings>
pom.xml (in the project)
<project>
...
<profiles>
<profile>
<id>prod</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<server>prod</server>
<url>http://host:XXXX/manager/text</url>
<path>/</path>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
Update: Yes, there is an opportunity to keep this in .properties-files, but:
- It's a bit strange to keep server configuration in several places, i.e. ~/.m2/settings.xml, application.properties, pom.xml. As long as username and password are able to be stored in settings.xml, it would be nice to keep server URL also there.
- Actually I couldn't make it work, so I'm keep working on this way as workaround...
Update 2: Just found out, why the approach with reading properties didn't work for me. I used:
mvn tomcat7:redeploy
to deploy application, and properties-maven-plugin didn't inject properties in the placeholders in tomcat7-maven-plugin configuration. After I changed tomcat7-maven-plugin execution due to deploy phase, then the injection of properties works properly by invocation:
mvn clean deploy
But never the less, I would like to know, is it possible to keep server URL in settings.xml?