我目前正在通过jetty.xml
文件设置端口,并且我一直在尝试从新的文档中找出如何通过Maven的配置来实际定义httpConnector
。Eclipse网站上的文档似乎有点含糊,我已经尝试了一段时间来解决这个问题,因此最终使用了一个jetty.xml
。现在我想找出做这件事的正确方法。
我目前使用的是org.eclipse.jetty:jetty-maven-plugin:9.2.1.v20140609
。
发布于 2014-09-03 20:38:28
您可以通过pom.xml
配置端口
<build>
<plugins>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.2.1.v20140609</version>
<configuration>
<httpConnector>
<port>9999</port>
</httpConnector>
</configuration>
</plugin>
</plugins>
</build>
发布于 2017-10-18 23:24:21
这对我来说是有效的,因为我目前正在我的chrome的8088端口上调试服务器。
mvn jetty:run -Dhttp.port=8088
发布于 2018-03-22 17:39:08
默认情况下,Jetty在8080端口上运行,如果系统中的任何应用程序(如oracle DB )使用该端口,则Jetty服务器将不会启动,并给出一些绑定异常。为了克服这个问题,如果你的项目是maven项目,那么在pom.xml文件中使用下面的代码,那么它可以完美地工作(这里我使用的是在我的系统中免费的端口8888 )
<!-- The Jetty plugin allows us to easily test the development build by
running jetty:run on the command line. -->
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>${jetty.plugin.version}</version>
<configuration>
<scanIntervalSeconds>2</scanIntervalSeconds>
<httpConnector>
<host>localhost</host>
<port>8888</port>
</httpConnector>
</configuration>
</plugin>
https://stackoverflow.com/questions/25644036
复制相似问题