【问题标题】:run-forked Does Not Start Jetty Serverrun-forked 不启动 Jetty 服务器
【发布时间】: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-forkedrun 一样工作(只是在另一个JVM 中)。我检查了the manual 中缺少的配置,但找不到任何东西。

mvn jetty:stop 也可以工作,并且 not 打印“Jetty not running!”,所以某处有一个 Jetty。只是没有 webapp。

如何让run-forked 启动我的网络应用程序?

【问题讨论】:

标签: maven jetty


【解决方案1】:

更新 Maven 插件有效,所以我猜这是一个错误:

<plugin>
    <groupId>org.eclipse.jetty</groupId>
    <artifactId>jetty-maven-plugin</artifactId>
    <version>9.4.25.v20191220</version>
    <configuration>
        <supportedPackagings>jar</supportedPackagings>
    </configuration>
    <!-- Rest of config same as above -->
</plugin>

注意:我需要在现有配置中额外添加supportedPackagings,否则我得到“packaging type [jar] is unsupported”。)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-05-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-09-03
    • 2016-09-21
    • 1970-01-01
    • 2010-11-04
    相关资源
    最近更新 更多