在当前项目和插件组(本地、中央)中找不到前缀“jetty”的插件

2023-12-21

为了轻松运行我的 web 应用程序,我决定将 Jetty 添加到我的单个 POM 文件中。

官方文档 https://www.eclipse.org/jetty/documentation/9.4.x/maven-and-jetty.html#configuring-embedded-jetty-with-maven,我将其添加到我的<plugins>:

  <plugin>
    <groupId>org.eclipse.jetty</groupId>
    <artifactId>jetty-maven-plugin</artifactId>
    <version>9.4.0-SNAPSHOT</version>
  </plugin>

PROBLEM: mvn jetty:run fails:

$ mvn jetty:start
[INFO] Scanning for projects...
[WARNING] The POM for org.eclipse.jetty:jetty-maven-plugin:jar:9.4.0-SNAPSHOT is missing, no dependency information available
[WARNING] Failed to retrieve plugin descriptor for org.eclipse.jetty:jetty-maven-plugin:9.4.0-SNAPSHOT: Plugin org.eclipse.jetty:jetty-maven-plugin:9.4.0-SNAPSHOT or one of its dependencies could not be resolved: Could not find artifact org.eclipse.jetty:jetty-maven-plugin:jar:9.4.0-SNAPSHOT
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-metadata.xml
Downloading: https://repo.maven.apache.org/maven2/org/codehaus/mojo/maven-metadata.xml
Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-metadata.xml (13 KB at 2.1 KB/sec)
Downloaded: https://repo.maven.apache.org/maven2/org/codehaus/mojo/maven-metadata.xml (20 KB at 3.2 KB/sec)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.013 s
[INFO] Finished at: 2016-08-17T16:49:28+09:00
[INFO] Final Memory: 14M/307M
[INFO] ------------------------------------------------------------------------
[ERROR] No plugin found for prefix 'jetty' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (/home/nico/.m2/repository), central (https://repo.maven.apache.org/maven2)] -> [Help 1]

另一种方法在https://mvnrepository.com/artifact/org.eclipse.jetty/jetty-maven-plugin/9.4.0.M0 https://mvnrepository.com/artifact/org.eclipse.jetty/jetty-maven-plugin/9.4.0.M0建议将其添加到<dependencies>:

            <dependency>
                <groupId>org.eclipse.jetty</groupId>
                <artifactId>jetty-maven-plugin</artifactId>
                <version>9.4.0.M0</version>
            </dependency>

也失败了,mvn jetty:start says:

[ERROR] No plugin found for prefix 'jetty' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (/home/nico/.m2/repository), central (https://repo.maven.apache.org/maven2)] -> [Help 1]

我删除了我的.m2文件夹并让 Maven 重新创建它,这也好不到哪儿去。我没有settings.xml in ~/.m2这是内容~/.m2/repository/org/eclipse/jetty/jetty-maven-plugin/9.4.0.M0/:

-rw-rw-r-- 1 nico nico 101524  8月 24 17:29 jetty-maven-plugin-9.4.0.M0.jar
-rw-rw-r-- 1 nico nico     40  8月 24 17:29 jetty-maven-plugin-9.4.0.M0.jar.sha1
-rw-rw-r-- 1 nico nico   5526  8月 24 17:28 jetty-maven-plugin-9.4.0.M0.pom
-rw-rw-r-- 1 nico nico     40  8月 24 17:28 jetty-maven-plugin-9.4.0.M0.pom.sha1
-rw-rw-r-- 1 nico nico    215  8月 24 17:29 _remote.repositories

注意:关于同一主题有几个问题,所有问题都有过时的答案,其中包含可追溯到 Jetty 迁移到 Eclipse 之前的 Maven id(mortbay、codehaus),或者建议添加<plugin>在我的问题顶部看到的块。


您使用的是插件版本9.4.0-SNAPSHOT。该版本在中央存储库中不可用(可用版本 http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.eclipse.jetty%22%20AND%20a%3A%22jetty-maven-plugin%22).

要添加一个dependency并不能解决问题,因为依赖关系与plugin。依赖关系是使用或需要通过你想要编译的代码和插件是可以的编译、构建或分析你的代码。

简而言之:

  • 你不需要dependency on jetty-maven-plugin
  • 你必须改变version of the plugin到中央或本地存储库中可用的版本。
    例如:

    <plugin>
        <groupId>org.eclipse.jetty</groupId>
        <artifactId>jetty-maven-plugin</artifactId>
        <version>9.4.0.M0</version>
    </plugin>
    
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

在当前项目和插件组(本地、中央)中找不到前缀“jetty”的插件 的相关文章

随机推荐