问题描述
我希望cargo Maven插件启动Tomcat7,因此我将其放入pom:
I want cargo maven plugin to start a Tomcat7 so i put into my pom:
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.2.0</version>
<!-- minimal configuration to let adb run (mvn package org.codehaus.cargo:cargo-maven2-plugin:run) in a local tomcat -->
<configuration>
<containerId>tomcat7x</containerId>
<containerUrl>http://archive.apache.org/dist/tomcat/tomcat-7/v7.0.16/bin/apache-tomcat-7.0.16.zip
</containerUrl>
<configuration>
<properties>
<cargo.servlet.port>1718</cargo.servlet.port>
</properties>
</configuration>
</configuration>
</plugin>
问题是如果我跑步:
mvn package org.codehaus.cargo:cargo-maven2-plugin:run
一切正常,但如果我运行
all is working fine but if i run
mvn package org.codehaus.cargo:cargo-maven2-plugin:start
在pom中设置的配置被忽略:未定义容器,使用默认的[jetty6x,嵌入式]容器"
the configuration set in pom is beeing ignored:"No container defined, using a default [jetty6x, embedded] container"
您可以轻松重现此内容.只需创建一个战争专家应用程序:
you can reproduce this easily. just create an war-maven app:
mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-webapp -DarchetypeArtifactId=maven-archetype-webappp
然后将上面的代码添加到pom并运行两个命令.
Then add the code above to pom and run both commands.
那么如何为目标start
正确设置ContainerId
和Url
-我错过了什么吗?!
So how to set ContainerId
and Url
properly for goal start
-- Am I missing something?!
推荐答案
所以我联系了货运支持部门.上面的配置确实只适用于运行目标,但是还有一种配置对两者都适用(货物文档以某种方式误导了):
so i contacted cargo support. the configuration above works indeed only with run goal, but there is also a configuration that works with both (the cargo doc is somehow misguiding):
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.2.0</version>
<!-- minimal configuration to let adb run (mvn package org.codehaus.cargo:cargo-maven2-plugin:run) in a local tomcat -->
<configuration>
<container>
<containerId>tomcat7x</containerId>
<zipUrlInstaller>
<url>http://archive.apache.org/dist/tomcat/tomcat-7/v7.0.16/bin/apache-tomcat-7.0.16.zip</url>
</zipUrlInstaller>
</container>
<configuration>
<properties>
<cargo.servlet.port>1718</cargo.servlet.port>
</properties>
</configuration>
</configuration>
</plugin>
注意附加的容器和zipUrlInstaller标记,而不是containerUrl.
notice the additional container and zipUrlInstaller tag instead of containerUrl.
这篇关于货运Maven插件-启动目标忽略配置,“运行"工作正常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!