2013-12-22 91 views
2

我在使用maven tomcat插件嘗試將我的webapp部署設置爲tomcat 7時遇到問題。Maven在使用tomcat7-maven-plugin時找不到tomcat7目標

的settings.xml:

<server> 
    <id>server</id> 
    <username>admin</username> 
    <password>password</password> 
</server> 

的pom.xml:

<plugin> 
    <groupId>org.apache.tomcat.maven</groupId> 
    <artifactId>tomcat7-maven-plugin</artifactId> 
    <version>2.2</version> 
    <configuration> 
    <server>server</server> 
    <url>http://localhost:8080/manager/text</url> 
    <path>/myapp</path> 
    </configuration> 
</plugin> 

當我開始鍵入mvn tom<tab>自動完成建議我只mvn tomcat:

輸出爲mvn tomcat:list是:

[INFO] Scanning for projects... 
[INFO] Searching repository for plugin with prefix: 'tomcat'. 
[INFO] ------------------------------------------------------------------------ 
[INFO] Building myapp 
[INFO] task-segment: [tomcat:list] 
[INFO] ------------------------------------------------------------------------ 
[INFO] [tomcat:list {execution: default-cli}] 
[INFO] Listing applications at http://localhost:8080/manager 
[INFO] ------------------------------------------------------------------------ 
[ERROR] BUILD ERROR 
[INFO] ------------------------------------------------------------------------ 
[INFO] Cannot invoke Tomcat manager 

Embedded error: http://localhost:8080/manager/list 
[INFO] ------------------------------------------------------------------------ 
[INFO] For more information, run Maven with the -e switch 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 1 second 
[INFO] Finished at: Sun Dec 22 21:37:08 MSK 2013 
[INFO] Final Memory: 13M/211M 
[INFO] ------------------------------------------------------------------------ 

它看起來像該tomcat6中,Maven的插件實際上是在使用中。

的輸出mvn tomcat7:list是:

[INFO] Scanning for projects... 
[INFO] ------------------------------------------------------------------------ 
[ERROR] BUILD FAILURE 
[INFO] ------------------------------------------------------------------------ 
[INFO] Required goal not found: tomcat7:list in org.apache.tomcat.maven:tomcat7-maven-plugin:2.2 
[INFO] ------------------------------------------------------------------------ 
[INFO] For more information, run Maven with the -e switch 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: < 1 second 
[INFO] Finished at: Sun Dec 22 21:43:41 MSK 2013 
[INFO] Final Memory: 7M/116M 
[INFO] ------------------------------------------------------------------------ 

我使用Ubuntu 13.10,所有的軟件都通過庫安裝。

回答

1

據我所知,tomcat7 mojo還沒有一些目標,mvn tomcat7:list就是其中之一。 mvn tomcat6:list可用於tomcat6 mojo。

+1

是的,你是對的http://tomcat.apache.org/maven-plugin-2.2/#Known_limitations – user241221

相關問題