我在我的pom中添加了一个maven-jetty插件,如下所示:
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.16</version>
<configuration>
<connectors>
<connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
<host>${jetty.host}</host>
<port>${jetty.port}</port>
<maxIdleTime>30000</maxIdleTime>
</connector>
</connectors>
<scanIntervalSeconds>10</scanIntervalSeconds>
<stopPort>${jetty.stop.port}</stopPort>
<stopKey>STOP</stopKey>
<contextPath>${jetty.contextpath}</contextPath>
</configuration>
<executions>
<execution>
<id>start-jetty</id>
<phase>pre-integration-test</phase>
<goals>
<goal>stop</goal>
<goal>run</goal>
</goals>
<configuration>
<scanIntervalSeconds>0</scanIntervalSeconds>
<daemon>true</daemon>
</configuration>
</execution>
<execution>
<id>stop-jetty</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>这在windows7下运行得很好,但是如果我尝试在Linux (SuSE)下执行它,它总是失败,并且地址已经在使用中。
我尝试了localhost和127.0.0.1作为jetty.host,并尝试了一些数字作为端口。我检查了linux系统上的端口,它们都没有被其他服务使用。
我在两个系统上都使用maven 3.0.3和JDK 1.6_29。
有什么想法吗?
发布于 2012-01-09 16:43:19
这是我错过检查的停靠端口!
发布于 2012-01-09 16:35:47
您可以查看哪个进程打开了端口:
http://www.cyberciti.biz/faq/what-process-has-open-linux-port/
使用
netstat -tulpn您将在右侧看到相应的进程。
发布于 2013-11-05 11:30:06
使用以下命令尝试不同的端口
mvn -Djetty.port=7000 jetty:运行
https://stackoverflow.com/questions/8761291
复制相似问题