如何安装tomcat maven插件?

时间:2015-01-23 17:19:34

标签: java maven tomcat cxf maven-archetype

我试图运行基本的CXF maven原型。

我刚尝试使用以下方法手动安装tomcat7-maven-plugin-2.2.jar:

mvn -X install:install-file -Dfile=/tmp/path/tomcat7-maven-plugin-2.2.jar -DgroupId=org.apache.tomcat.maven -DartifactId=tomcat7-maven-plugin -Dversion=2.2 -Dpackaging=jar

导致:

[INFO] Installing /tmp/path/tomcat7-maven-plugin-2.2.jar to /home/userxxx/.m2/repository/org/apache/tomcat/maven/tomcat7-maven-plugin/2.2/tomcat7-maven-plugin-2.2.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: < 1 second
[INFO] Finished at: Fri Jan 23 17:50:42 CET 2015
[INFO] Final Memory: 4M/179M
[INFO] ------------------------------------------------------------------------

但是当我尝试通过以下方式在我的项目中调用它时:

mvn clean install tomcat:run-war

它说:

[INFO] Searching repository for plugin with prefix: 'tomcat'.
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] The plugin '**org.codehaus.mojo**:tomcat-maven-plugin' does not exist or no valid version could be found

你是否知道为什么maven正在寻找&#34; org.codehaus.mojo&#34; groupId而不是&#34; org.apache.tomcat.maven&#34; ?

我知道它是在&#34; org.codehaus.mojo&#34;之前,它也是一个错误吗?

我应该在这个groupId中安装插件吗?

1 个答案:

答案 0 :(得分:1)

好的,我明白了,CXF原型中的评论是错误的:

            <!-- mvn clean install tomcat:run-war to deploy
            Look for "Running war on http://xxx" and
            "Setting the server's publish address to be /yyy"
            in console output; WSDL browser address will be
            concatenation of the two: http://xxx/yyy?wsdl
            -->

应该说mvn clean install **tomcat7**:run-war to deploy与他们在这个原型中使用的插件相对应。