有人可以帮我解决这个问题吗...我花了太多时间解决这个错误,但无法解决...
[ERROR] Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.1:
deploy (default-cli) on project HelloMaven: Cannot invoke Tomcat manager: Connection to http:// localhost:8080 refused: Connection refused: connect -> [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/ConnectException
以下是我的pom.xml:
<modelVersion>4.0.0</modelVersion>
<groupId>com.abc.app</groupId>
<artifactId>HelloMaven</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>HelloMaven Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>HelloMaven</finalName>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.0</version>
<configuration>
<url>http://localhost:8080/manager/html</url>
<server>TomcatServer</server>
<path>/HelloMaven</path>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
最佳答案
首先确定您正在运行的Tomcat版本。这一点非常重要,因为配置略有不同。我将在Tomcat 7中对其进行描述。
在您的tomcat-user.xml中定义一个新用户,并为其分配特权“ manager-script”。该用户不应有其他管理员-...-角色。
打开您的pom.xml并更改tomcat7-plugin的配置。将网址更改为http:// localhost:8080 / manager / text。请记住,您使用文本控制台而不是html控制台。
转到settings.xml并检查是否有服务器配置,该配置具有您在tomcat7-plugin-configuration中使用的相应ID。
例如:
<server>
<id>TomcatServer</id>
<username>scriptuser</username>
<password>mypassword</password>
</server>