Java 401(未经授权)使用maven将war部署到远程Tomcat 8时出错
我试图在远程Tomcat8上部署war,但在这个过程中出现401(未经授权)错误 错误日志 为部署而执行的命令 pom.xmlJava 401(未经授权)使用maven将war部署到远程Tomcat 8时出错,java,maven,tomcat,Java,Maven,Tomcat,我试图在远程Tomcat8上部署war,但在这个过程中出现401(未经授权)错误 错误日志 为部署而执行的命令 pom.xml http://gsi-547576:8080/manager/text org.apache.tomcat.maven tomcat7 maven插件 2.2 ${integration.tomcat.url} 集成tomcat /${project.artifactId} tomcat-users.xml 请指导。您需要为“integration tomcat
http://gsi-547576:8080/manager/text
org.apache.tomcat.maven
tomcat7 maven插件
2.2
${integration.tomcat.url}
集成tomcat
/${project.artifactId}
tomcat-users.xml
请指导。您需要为“integration tomcat”服务器定义凭据;这通常在~/.m2/settings.xml文件中完成:
<servers>
<server>
<id>integration-tomcat</id>
<username>manager</username>
<password>manager</password>
</server>
</servers>
集成tomcat
经理
经理
您需要为“integration tomcat”服务器定义凭据;这通常在~/.m2/settings.xml文件中完成:
<servers>
<server>
<id>integration-tomcat</id>
<username>manager</username>
<password>manager</password>
</server>
</servers>
集成tomcat
经理
经理
如果这对将来的人有帮助,我发现如果Tomcat-users.xml中的密码以数字而不是字母开头,Tomcat将返回401。只有在尝试通过curl或使用cargo maven插件通过GitLab进行部署时,才会出现这种情况。(在Eclipse中运行maven deploy工作得很好)
更改密码以字母开头修复了curl的问题,从GitLab部署时,如果这对将来的人有帮助,我发现如果Tomcat-users.xml中的密码以数字而不是字母开头,Tomcat将返回401。只有在尝试通过curl或使用cargo maven插件通过GitLab进行部署时,才会出现这种情况。(在Eclipse中运行maven deploy工作得很好)
更改密码以字母开头修复了curl的问题,从GitLab部署时,请不要忘记使用此标记进行封装(如果没有它,我将无法工作):。。。别忘了用这个标签封装(没有它我就无法工作):。。。
<properties>
<integration.tomcat.url>http://gsi-547576:8080/manager/text</integration.tomcat.url>
</properties>
<!-- Deploy to Remote Tomcat -->
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<url>${integration.tomcat.url}</url>
<server>integration-tomcat</server>
<path>/${project.artifactId}</path>
</configuration>
</plugin>
<role rolename="tomcat" />
<role rolename="manager-gui" />
<role rolename="manager-script" />
<role rolename="admin-gui" />
<user username="manager" password="manager" roles="tomcat,manager-gui,admin-gui,manager-script" />
<servers>
<server>
<id>integration-tomcat</id>
<username>manager</username>
<password>manager</password>
</server>
</servers>