参考:http://my.oschina.net/amoshuang/blog/108079
自动部署Tomcat错误排除
http://www.cnblogs.com/yuandingjiema/archive/2012/12/23/2829822.html
http://hi.baidu.com/ae6623/item/809c7cfb3f9eae4d922af272
----------------------------------------------------------------------------
maven deploy到远程服务器的时候返回401(未认证)错误,有如下2个原因:
1、tomcat-users.xml没有配置好用户角色,settings.xml没有对应好
tomcat-users.xml
<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<user username="tomcat" password="admin" roles="manager-gui" />
<user username="root" password="123456" roles="manager-script" />
settings.xml
<server>
<id>tomcat-manager</id>
<username>root</username>
<password>123456</password>
</server>
pom.xml
<!-- tomcat 部署插件 -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<version>${tomcat-maven.version}</version>
<configuration>
<url>http://10.86.11.209:8080/manager/text</url>
<server>tomcat-manager</server>
<path>/test</path>
<charset>${project.build.sourceEncoding}</charset>
</configuration>
</plugin>
eclipse maven build命令:clean tomcat:deploy -Pproduction -X
2、如果eclipse中deploy到远程tomcat没有问题,但是命令行deploy的时候又提示401错误,那就是命令行没有指定正确的settings.xml文件:
命令行deploy命令:mvn clean tomcat:deploy -sd:/.m2/settings.xml -Pproduction -X
【转】eclipse中远程部署war项目至tomcat
猜你喜欢
转载自superich2008.iteye.com/blog/2046140
今日推荐
周排行