パスワードが空白の場合、maven tomcat プラグインを使用して、war を tomcatに正常にデプロイできます。
settings.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>