Maven Tomcat 部署
生活随笔
收集整理的這篇文章主要介紹了
Maven Tomcat 部署
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
來源:http://www.cnblogs.com/warrior/archive/2012/07/24.html
Tomcat conf 下的tomcat-users.xml 增加
<role rolename="manager"/> <role rolename="admin"/> <role rolename="manager-gui"/> <user username = "admin" password = "password" roles = "admin,manager,manager-gui,manager-script,manager-jmx,manager-status" />啟動tomcat7,然后訪問?http://localhost:8080/manager/html,輸入admin/password,如果出現以下界面,表示tomcat一切OK
如果是Tomcat6?http://localhost:8080/manager
在Maven的conf目錄中的setting.xml?servers節點增加
<server> <id>healthpad</id> <username>admin</username> <password>password</password> </server>修改pom.xml
<plugin><artifactId>maven-war-plugin</artifactId><version>2.1.1</version><configuration><packagingExcludes>WEB-INF/web.xml</packagingExcludes></configuration> </plugin> <plugin><groupId>org.codehaus.mojo</groupId> <artifactId>tomcat-maven-plugin</artifactId> <version>1.1</version> <configuration><url>http://localhost:8080/manager/html</url><server>healthpad</server><username>admin</username> <password>password</password> </configuration> </plugin>Tomcat6 在Url中輸入?http://localhost:8080/manager
右擊Java項目,運行 輸入?在Goals中添加:package tomcat:redeploy
異常解決
Failed to execute goal org.codehaus.mojo:tomcat-maven-plugin:1.1:deploy (default-cli) on project healthpad:Cannot invoke Tomcat manager:Server returned HTTP response code:401for URL: http://localhost:8080/manager/html/deploy?path=%2FmkyWebApp&war= -> [Help 1]這種問題在 pom.xml中增加 username password
<configuration>
<url>http://localhost:8080/manager/html</url>
<server>healthpad</server>
<username>admin</username>?
<password>password</password>?
</configuration>
?
如果是403,請手工在瀏覽器中訪問 http://localhost:8080/manager/html/deploy 調整 tomcat下的tomcat-users.xml 角色權限總結
以上是生活随笔為你收集整理的Maven Tomcat 部署的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: python有什么版本(Python)
- 下一篇: 锐龙2600x配什么主板