我有一个 maven web 项目,当我为此目标发布 maven 构建时 > clean install tomcat:run
,这将启动 tomcat 服务器。不管怎样,由于这个错误,服务器无法启动:
[ERROR] Failed to execute goal org.codehaus.mojo:tomcat-maven-plugin:1.1:run (default-cli) on project WebEngineering: Could not start Tomcat: Protocol handler initialization failed: java.net.BindException: Address already in use :8080 -> [Help 1]
我刚刚意识到有另一个应用程序正在使用端口 8080,我不想失去它。我可以知道如何更改 8080 以外的当前项目端口号吗?
最佳答案
在 pom.xml
中,您声明了 apache tomcat maven 插件,您可以设置或更改端口号,例如:
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<!-- or if you want to use tomcat 6.x
<artifactId>tomcat6-maven-plugin</artifactId>
-->
<version>2.0</version>
<configuration>
<!-- http port -->
<port>9090</port>
<!-- application path always starts with /-->
<path>/</path>
...
</plugin>
关于eclipse - 如何在eclipse 中配置maven tomcat 端口?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18511774/