jetty-maven-plugin :stop > 参数 'stopKey'、'stopPort' 丢失或无效

jetty-maven-plugin :stop > The parameters 'stopKey', 'stopPort' are missing or invalid

我使用以下 link 地址创建并 运行 简单项目:

Create and Run Your First ZK Application with Eclipse and Maven.

但是当我构建...时出现以下错误:

[ERROR] Failed to execute goal org.mortbay.jetty:jetty-maven-plugin:7.6.8.v20121106:stop (default-cli) on project asd: The parameters 'stopKey', 'stopPort' for goal org.mortbay.jetty:jetty-maven-plugin:7.6.8.v20121106:stop are missing or invalid -> [Help 1]

您可以将 pom.xml 的设置替换为以下设置。

<plugin>
    <groupId>org.mortbay.jetty</groupId>
    <artifactId>jetty-maven-plugin</artifactId>
    <version>7.6.8.v20121106</version>
    <configuration>
        <webAppConfig>
            <contextPath>/${project.artifactId}</contextPath>
            <allowDuplicateFragmentNames>true</allowDuplicateFragmentNames>
        </webAppConfig>
        <scanIntervalSeconds>5</scanIntervalSeconds>
    </configuration>
</plugin>

您的项目使用的是旧版本的码头插件。通过将版本标记值更改为:

,将其更新为 stopKeystopPort 可选的版本
<version>9.4.3.v20170317</version>

这里有关于配置 maven jetty 插件的完整说明:http://www.eclipse.org/jetty/documentation/current/jetty-maven-plugin.html

遇到与您相同的问题,决定用 Tomcat 替换 Jetty 服务器以解决此问题。在您的 pom.xml 中使用以下内容。

<plugin>
    <groupId>org.apache.tomcat.maven</groupId>
    <artifactId>tomcat7-maven-plugin</artifactId>
    <version>2.2</version>
    <configuration>
        <webAppConfig>
            <contextPath>/${project.artifactId}</contextPath>
            <allowDuplicateFragmentNames>true</allowDuplicateFragmentNames>
        </webAppConfig>
        <scanIntervalSeconds>5</scanIntervalSeconds>
    </configuration>
</plugin>

另外,当从 Eclipse 执行 'Run As' 时,将目标从之前描述的 jetty:stop jetty:run 更改为 tomcat7:shutdown tomcat7:run