【发布时间】:2020-01-07 12:59:20
【问题描述】:
我在我的构建中添加了一个jetty-maven-plugin,如下所示:
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>8.1.16.v20140903</version>
<executions>
<execution>
<id>run-jetty</id>
<goals>
<goal>run</goal>
</goals>
<phase>install</phase>
<configuration>
<webAppSourceDirectory>${basedir}/target/repository/</webAppSourceDirectory>
<webApp>
<contextPath>/site</contextPath>
</webApp>
<!-- run only -->
<scanIntervalSeconds>10</scanIntervalSeconds>
<!-- run-forked only -->
<stopPort>9099</stopPort>
<stopKey>stopPlease</stopKey>
<stopWait>10</stopWait>
<waitForChild>false</waitForChild>
</configuration>
</execution>
</executions>
</plugin>
当我运行周围的 Maven 项目时,Jetty 服务器启动正常,我可以在 http://localhost:8080/site/ 浏览 webapp
但是,当我将目标 run 替换为 run-forked 时,我会在控制台中看到以下信息:
[INFO] --- jetty-maven-plugin:8.1.5.v20120716:run-forked (run-jetty) @ project ---
[INFO] Configuring Jetty for project: maven-p2
[INFO] Forked process started
但是,http://localhost:8080/site/ 没有任何开始。至少那里没有webapp。操作系统在端口 8080 上报告了一个 Java 进程(实际上是两个),并在 9099 上监听了一些东西(我猜是停止处理程序)。
我似乎无法弄清楚如何让run-forked 像run 一样工作(只是在另一个JVM 中)。我检查了the manual 中缺少的配置,但找不到任何东西。
mvn jetty:stop 也可以工作,并且 not 打印“Jetty not running!”,所以某处有一个 Jetty。只是没有 webapp。
如何让run-forked 启动我的网络应用程序?
【问题讨论】:
-
Jetty 8.x 是 EOL (End of Life),考虑升级。 - eclipse.org/jetty/documentation/current/what-jetty-version.html