任何帮助将不胜感激,因为此配置适用于 mac 但不适用于 windows 机器。
我的命令: mvn clean install && mvn tomcat7:redeploy
错误信息:
--- tomcat7-maven-plugin:2.2:redeploy (default-cli) @ web-customer-tracker ---
[INFO] Deploying war to http://localhost:8080/web-customer-tracker
Uploading: http://localhost:8080/manager/text/deploy?path=%2Fweb-customer-tracker&update=true
2692/20011 KB
[INFO] I/O exception (java.net.SocketException) caught when processing request: Connection reset by peer: socket write error
[INFO] Retrying request
Uploading: http://localhost:8080/manager/text/deploy?path=%2Fweb-customer-tracker&update=true
2692/20011 KB
[INFO] I/O exception (java.net.SocketException) caught when processing request: Connection reset by peer: socket write error
[INFO] Retrying request
Uploading: http://localhost:8080/manager/text/deploy?path=%2Fweb-customer-tracker&update=true
2884/20011 KB
[INFO] I/O exception (java.net.SocketException) caught when processing request: Connection reset by peer: socket write error
[INFO] Retrying request
Uploading: http://localhost:8080/manager/text/deploy?path=%2Fweb-customer-tracker&update=true
2884/20011 KB
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.686 s
[INFO] Finished at: 2018-07-14T21:19:25+05:30
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.2:redeploy (default-cli) on project web-customer-tracker: Cannot invoke Tomcat manager: Connection reset by peer: socket write error -> [Help 1]
Tomcat 运行在 8080 端口
pom.xml
<build>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<url>http://localhost:8080/manager/text</url>
<server>TomcatServer</server>
<path>/web-customer-tracker</path>
</configuration>
</plugin>
</plugins>
<finalName>web-customer-tracker</finalName>
</build>
~/.m2/settings.xml
<server>
<id>TomcatServer</id>
<username>admin</username>
<password>password</password>
</server>
tomcat-用户.xml
<tomcat-users xmlns="http://tomcat.apache.org/xml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://tomcat.apache.org/xml tomcat-users.xsd"
version="1.0">
<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<user username="admin" password="password" roles="manager-gui,manager-script"/>
</tomcat-users>
Tomcat :9.0.10 马文:3.3.4 JDK:Java 版本“1.8.0_172”
最佳答案
在尝试了几乎所有方法之后,我删除了 m2 中的 settings.xml。然后我在我的 pom.xml 中做了以下更改
<build>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<url>http://localhost:8080/manager/text</url>
<server>TomcatServer</server>
<username>admin</username>
<password>password</password>
<path>/web-customer-tracker</path>
</configuration>
</plugin>
</plugins>
<finalName>web-customer-tracker</finalName>
</build>
我将 settings.xml 中的用户名和密码添加到 pom 文件中,它起作用了。请注意,此问题不会发生在基于 UNIX 的系统上。
关于java - 通过 Maven 在 tomcat9 上部署 war 时出错 - Windows,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51341135/