tomcat-maven-plugin 403错误 [英] tomcat-maven-plugin 403 error
问题描述
当我使用mvn tomcat:tomcat-maven-plugin的部署时,出现403错误:
When I use mvn tomcat:deploy of tomcat-maven-plugin there is a 403 error:
无法在项目my-webapp上执行目标org.codehaus.mojo:tomcat-maven-plugin:1.0:deploy(default-cli):无法调用Tomcat管理器:服务器返回URL的HTTP响应代码:403:
Failed to execute goal org.codehaus.mojo:tomcat-maven-plugin:1.0:deploy (default-cli) on project my-webapp: Cannot invoke Tomcat manager: Server returned HTTP response code: 403 for URL: http://localhost:8080/manager/text/deploy?path=%2Fdms&war=
我认为是因为战争参数为空.但是为什么它为空呢??
I think it because of null war parameter. But why is it null???
在pom.xml中有:
In pom.xml there is:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<configuration>
<warFile>target\my-webapp.war</warFile>
<server>myserver</server>
<url>http://localhost:8080/manager/text</url>
<path>/dms</path>
</configuration>
</plugin>
推荐答案
默认情况下,/manager
应用程序由用户名/密码保护.如果输入 http://localhost:8080/manager ,还将要求您提供安全凭证.首先在Tomcat中创建/启用用户:取消或尝试几次失败后,Tomcat会在错误屏幕上提供帮助.然后按照此处中的说明在tomcat-maven-plugin
中使用这些凭据:
The /manager
application is by default secured by username/password. If you enter http://localhost:8080/manager you will be asked to provide security credentials as well. First create/enable user in Tomcat: after canceling or few unsuccessful attempts Tomcat will provide help on error screen. Then use these credentials in tomcat-maven-plugin
as explained here:
在您的pom.xml中添加一个插件配置块:
Add a plugin configuration block to your pom.xml:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<configuration>
<server>myserver</server>
</configuration>
</plugin>
在您的settings.xml中添加一个相应的服务器块:
Add a corresponding server block to your settings.xml:
<server>
<id>myserver</id>
<username>myusername</username>
<password>mypassword</password>
</server>
这篇关于tomcat-maven-plugin 403错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!