I have a maven project and locally everything perfectly. When I do maven tomcat7:redeploy everything works perfectly. When I run that same project on Jenkins then the wrong profile properties are loaded.
This is the situation. In my pom.xml in the build plugins section I have this:
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<server>${tomcat-server}</server>
<url>${tomcat-url}</url>
<path>${tomcat-context}</path>
</configuration>
</plugin>
In my settings.xml I have this:
<profiles>
<profile>
<id>tomcat-localhost</id>
<properties>
<tomcat-server>local.server</tomcat-server>
<tomcat-context>/MyProject</tomcat-context>
</properties>
</profile>
<profile>
<id>tomcat-test</id>
<properties>
<tomcat-server>test.server</tomcat-server>
<tomcat-context>/</tomcat-context>
</properties>
</profile>
</profiles>
in the servers section I have defined the username and passwords for the servers. Now I configure my Maven project in Jenkins and in the maven section I set this in the goals and options field:
tomcat7:redeploy -P tomcat-test
This means that Jenkins should load the properties of the profile with id tomcat-test however when the war file gets uploaded I see this in the job console:
Uploading:
http://localhost:8080/manager/text/deploy?path=%2FMyProject&update=trueEven though I have clearly indicated that maven should load the tomcat-test properties, it loads the tomcat-localhost instead. Outside of Jenkins, locally on my machine, it works properly.