当密码为空时,我可以通过 maven tomcat 插件成功地将我的战争部署到 tomcat :
设置.xml
<server>
<id>local_tomcat</id>
<username>admin</username>
<password></password>
</server>
tomcat-users.xml
<role rolename="manager-gui" />
<role rolename="manager-script" />
<user username="admin" password="" roles="tomcat,admin,manager-gui,manager-script" />
但是,如果我只将密码更改为非空白(例如 foobar)并重新启动 tomcat,那么我将无法再部署:
[ERROR] Failed to execute goal org.codehaus.mojo:tomcat-maven-plugin:1.1:deploy (default-cli) on project myapp: Cannot invoke Tomcat manager: Server returned HTTP response code: 401 for URL: http://localhost:8080/manager/html/deploy?path=%2Fmyapp&war= -> [Help 1]
知道是什么原因造成的吗?
编辑:
我的 pom.xml 有:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<configuration>
<server>local_tomcat</server>
<url>http://localhost:8080/manager/html</url>
</configuration>
</plugin>