The plugin 'org.apache.maven.plugins:maven-tomcat-plugin' does not exist or no v

不淨之心發表於2013-03-22
[url]http://blog.csdn.net/walkingmanc/article/details/5856491[/url]
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] The plugin 'org.apache.maven.plugins:maven-tomcat-plugin' does not exist
or no valid version could be found


提示說maven-tomcat-plugin' 外掛不存在,仔細檢視一下pom檔案,發現裡面配置了 :

<plugin>
<groupId>org.codehaus.mojo</groupId>
[color=red][b]<artifactId>tomcat-maven-plugin</artifactId>[/b][/color]
</plugin>

那為什麼還報錯。

仔細觀察,發現mvn並沒有採用pom檔案裡面的配置來下載tomcat-maven-plugin,而是自以為是的去下載maven-tomcat-plugin' ,關於這個問題很多帖子上都反映過,如下:

Hi,

I'm trying to use tomcat-maven-plugin from
http://mojo.codehaus.org/tomcat-maven-plugin/

But when I type mvn tomcat:deploy, i get

[INFO]
----------------------------------------------------------------------------
[INFO] Building Design Council
[INFO] task-segment: [tomcat:deploy]
[INFO]
----------------------------------------------------------------------------
[INFO] Searching repository for plugin with prefix: 'tomcat'.
[ERROR] project-execute : myapp:myapp:war:0.1.0-SNAPSHOT (
task-segment: [tomcat:deploy] )
Diagnosis: The plugin 'org.apache.maven.plugins:maven-tomcat-plugin'
does not exist or no valid version could be found
FATAL ERROR: Error executing Maven for a project
org.apache.maven.lifecycle.LifecycleExecutionExcep tion: The plugin
'*org.apache.maven.plugins:maven-tomcat-plugin*' does not exist or no
valid version could be found

But I don't even have 'maven-tomcat-plugin' configured in my pom.xml!
I've tried removing whole repository, but the problem persists. I'm just
wondering if there is a way to make maven use a specific plugin for the
shortname tomcat?

這個老外也是這樣。

後來,找到一個帖子,

hey, I resolver the conflict by calling:
[color=red][b]mvn org.codehaus.mojo:tomcat-maven-plugin:deploy[/b][/color]


'Invalid task 'kasza': you must specify a valid lifecycle phase, or a
goal in the format plugin:goal or
*pluginGroupIdluginArtifactIdluginVersion:goal *'


知道了,可以通過指定完全限定名稱來解決這個問題。


[color=red][b]所以 只要將上面命令中的 tomcat 替換成 org.codehaus.mojo:tomcat-maven-plugin 就可以解決問題了。[/b][/color]

相關文章