问题描述
我正在使用tomcat maven插件来部署我的Java Web应用程序.现在,当我使用tomcat 7.0.32时,一切正常,这是我的插件配置
I'm using a tomcat maven plugin to deploy my java web app. Now everythings work when i use tomcat 7.0.32, this is my plugin configuration
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.1</version>
<configuration>
<url>http://localhost:8080/manager/text</url>
<server>my-tomcat</server>
<path>/myapp</path>
</configuration>
</plugin>
我的settings.xml配置
my settings.xml configuration
<servers>
<server>
<id>my-tomcat</id>
<username>manager</username>
<password>pwd</password>
</server>
</servers>
我的tomcat-users.xml
my tomcat-users.xml
<role rolename="manager-gui"/>
<user username="managerGui" password="pwd" roles="manager-gui"/>
<role rolename="manager-script"/>
<user username="manager" password="pwd" roles="manager-script"/>
如果使用其他版本的tomcat,例如7.0.50,则会收到以下错误消息
while if use a different version of tomcat, for example 7.0.50, i get the following error
我还尝试在
http://localhost:8080/manager/text
并且不起作用,而在7.0.32版本中,我会弹出身份验证弹出窗口.
and not work, while with the 7.0.32 version i get the authentication pop-up.
我在哪里做错了?
推荐答案
我遇到了类似的问题,通过在C:\ Users {userName} \.m2 \中创建settings.xml来解决此问题,内容如下<settings> <servers> <server> <id>my-tomcat</id> <username>manager</username> <password>pwd</password> </server> </servers></settings>
I faced similar issue, solved it by creating settings.xml in C:\Users{userName}\.m2\ with following content<settings> <servers> <server> <id>my-tomcat</id> <username>manager</username> <password>pwd</password> </server> </servers></settings>
似乎出于某种原因,插件未从%MAVEN_HOME%/conf/settings.xml中获取凭据,并希望其出现在C:\ Users {userName} .m2 \ settings.xml中
It seems for some reason plugin not picking up credentials from %MAVEN_HOME%/conf/settings.xml and expect it to present in C:\Users{userName}.m2\settings.xml
这篇关于maven tomcat7:deploy失败,状态码:403,ReasonPhrase:Forbidden的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!