【发布时间】:2016-08-03 19:44:25
【问题描述】:
我在多个地方看到除了我自己以外的人尝试了this link 中提供的所有解决方案,在浏览了 Google 上的每一页结果后,我都没有找到结果。我正在尝试将 maven 项目部署到 Tomcat,但得到以下打印输出:
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 11.178 s
[INFO] Finished at: 2016-08-03T15:01:17-04:00
[INFO] Final Memory: 15M/105M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.2:deploy (default-cli) on project Project_2: Cannot invoke Tomcat manager: Software caused connection abort: socket write error -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
两者
mvn tomcat7:deploy
和
mvn tomcat7:redeploy
导致同样的错误。
pom.xml
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<server>tomcat7</server>
<path>/Project_2</path>
<port>8085</port>
<url>http://localhost:8085/manager/text</url>
<update>true</update>
<username>manager</username>
<password>xxxx</password>
</configuration>
</plugin>
tomcat-users.xml
<role rolename="manager-script"/>
<role rolename="manager-gui"/>
<role rolename="manager-jmx"/>
<role rolename="manager-status"/>
<role rolename="admin-gui"/>
<user username="admin1" password="xxxx" roles="manager-gui,manager-script,manager-jmx,manager-status,admin-gui" />
<user username="manager" password="xxxx" roles="manager-script,admin-script" />
settings.xml(在 maven home 和 .m2 文件夹中)
<server>
<id>tomcat7</id>
<username>manager</username>
<password>xxxx</password>
</server>
我知道我的 Tomcat 版本是 8,但是,根据 Borgy Manotoy,Tomcat7 插件适用于 Tomcat 8。
【问题讨论】: