我已经在我的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>
这在Windows 7下工作正常,但如果我尝试在Linux(SuSE)下执行它,它总是会失败并且地址已经在使用中。
我尝试使用localhost和127.0.0.1作为jetty.host和一些数字作为端口。 我检查了linux系统上的端口,它们都没有被其他服务使用。
我在两个系统上都使用maven 3.0.3和JDK 1.6_29。
有什么想法吗?
答案 0 :(得分:1)
这是我错过了检查的STOP端口!
答案 1 :(得分:0)
您可以检查哪个进程已打开端口:
http://www.cyberciti.biz/faq/what-process-has-open-linux-port/
使用
netstat -tulpn
您将在右侧看到相应的流程。
答案 2 :(得分:0)
使用以下命令尝试使用其他端口
mvn -Djetty.port = 7000 jetty:run