我正在使用maven-jetty-plugin並試圖用-Djetty.port = 8090覆蓋我的jetty.xml設置,但它不工作。只有當我從文件的jetty.xml我得到移除連接部分的端口是8090如何用jetty.port覆蓋jetty.xml
所以:
mvn jetty:run -Djetty.port=8090
與連接器端口8080
開始,沒有連接器啓動端口8090
問題是我需要配置acceptors,stats和其他東西。我試着從連接器上只移除端口,但它不起作用。
我使用:
JAVA 1.7_05
MAVEN 3.0.4
Jetty 8.1.4
Linux Ubuntu 12.04 64bits
這裏是我的pom.xml插件配置:
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>8.1.4.v20120524</version>
<configuration>
<stopKey>foo</stopKey>
<stopPort>9990</stopPort>
<jettyXml>src/main/webapp/WEB-INF/jetty.xml</jettyXml>
</configuration>
<executions>
<execution>
<id>start-jetty</id>
<!-- <phase>pre-integration-test</phase> -->
<goals>
<goal>run</goal>
</goals>
<configuration>
<scanIntervalSeconds>0</scanIntervalSeconds>
</configuration>
</execution>
<execution>
<id>stop-jetty</id>
<!-- <phase>post-integration-test</phase> -->
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
的jetty.xml連接器的conf:
<Call name="addConnector">
<Arg>
<New class="org.eclipse.jetty.server.nio.SelectChannelConnector">
<Set name="host"><Property name="jetty.host" /></Set>
<Set name="port"><Property name="jetty.port" default="8080"/></Set>
<Set name="maxIdleTime">300000</Set>
<Set name="Acceptors">4</Set>
<Set name="statsOn">false</Set>
<Set name="confidentialPort">8443</Set>
<Set name="lowResourcesConnections">20000</Set>
<Set name="lowResourcesMaxIdleTime">5000</Set>
</New>
</Arg>
</Call>
在此先感謝!
更新1:也嘗試使用SystemProperty而不是Jetty.xml中的屬性。沒有工作
如果讀者不希望覆蓋指定一個jetty.xml文件,然後用系統屬性覆蓋默認端口在POM中的工作原理: '<配置> \t \t \t 碼頭。端口 \t \t $ {jetty.port} \t systemProperty> systemProperties> 配置> ' –
MiB
2013-12-22 02:34:17
的之前的評論應接受的答案 – 2014-05-23 10:56:03