How to specify core.cargo.version to use in cargo-maven2-plugin
I am trying to upgrade my existing maven application to use tomcat 7.10 and above.
On 7.8 I use the cargo-maven2-plugin to startup the tomcat container and deploy the webapp, this works fine.
On 7.10 and above this fails with the error:
[WARNING] [talledLocalContainer] 14/04/2011 12:21:43 PM org.apache.tomcat.util.digester.Digester startElement
[WARNING] [talledLocalContainer] SEVERE: Begin event threw exception
[WARNING] [talledLocalContainer] java.lang.ClassNotFoundException: org.apache.catalina.mbeans.ServerLifecycleListener
This is due to the fact that this library was removed from tomcat in 7.9 but the version of cargo I am using is still specifying this library in it's server.xml config.
The bug was fixed in cargo 1.1.0 ( http://jira.codehaus.org/browse/CARGO-923?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel )
I am trying to work out how to force the version of cargo that maven ( or more specifically cargo-maven2-plugin ) should be using.
The relevant part of my pom.xml looks like this:
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.0.6</version>
<configuration>
<container>
<containerId>tomcat7x</containerId>
<zipUrlInstaller>
<url>http://archive.apache.org/dist/tomcat/tomcat-7/v7.0.12/bin/apache-tomcat-7.0.12.zip</url>
<installDir>${user.home}/java/cargo/</installDir>
</zipUrlInstaller>
</container>
<configuration>
<properties>
<cargo.logging>low</cargo.logging>
<cargo.servlet.port>8280</cargo.servlet.port>
</properties>
</configuration>
</configuration>
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>start</goal>
</goals>
</execution>
</executions>
</plugin>
The problem is that t开发者_运维技巧his will always use cargo 1.6 via the cargo-maven2-plugin version number. If I check mvnrepository this is is the latest version that is available ( and is broken ).
If I try to specify core.cargo.version in the configuration->properties section it doesn't seem to make any difference.
Any ideas?
I know that this ticket is old but the answer can be useful for somebody else who would open it.
You can specify dependencies directly in your plugin definition in the pom.xml and thereby override the version of your plugin's dependencies like in the following sample. The version of the cargo-maven2-plugin
is 1.4.10
and I override the version of the some dependencies to use the 1.4.11
instead.
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.4.10</version>
<configuration>
<container>
<containerId>tomcat7x</containerId>
</container>
</configuration>
<executions>
<execution>
<id>run</id>
<goals>
<goal>start</goal>
</goals>
<phase>pre-integration-test</phase>
</execution>
<execution>
<id>finish</id>
<goals>
<goal>stop</goal>
</goals>
<phase>post-integration-test</phase>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-core-api-generic</artifactId>
<version>1.4.11</version>
</dependency>
<dependency>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-documentation</artifactId>
<version>1.4.11</version>
</dependency>
<dependency>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-daemon-client</artifactId>
<version>1.4.11</version>
</dependency>
<dependency>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-core-api-container</artifactId>
<type>test-jar</type>
<version>1.4.11</version>
</dependency>
</dependencies>
</plugin>
精彩评论