通过命令行指定端口:
mvn -Djetty.port=9999 jetty:run
另一种方式是在pom中的配置中通过指定新的connector来实现的,例如下述的配置文档:<plugin<groupIdorg.mortbay.jetty</groupId
<artifactIdmaven-jetty-plugin</artifactId
<version6.1.26</version
<configuration
<scanIntervalSeconds3</scanIntervalSeconds
<connectors
<connector implementation=org.mortbay.jetty.nio.SelectChannelConnector
<port9090</port
</connector
</connectors
<scanTargetPatterns
<scanTargetPattern
<directorysrc/main/webapp/WEB-INF</directory
<excludes
<exclude**/*.jsp</exclude
</excludes
<includes
<include**/*.properties</include
<include**/*.xml</include
</includes
</scanTargetPattern
</scanTargetPatterns
在你的配置文件中配置如下:
<!-- 网络服务连接器 -->
<bean class="org.eclipse.jetty.server.NetworkTrafficServerConnector" init-method="start">
<constructor-arg ref="jettyServer"></constructor-arg>
<property name="port" value="8080"></property>
</bean>
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)