【问题标题】:Mvn cannot install Jettymvn 无法安装 Jetty
【发布时间】:2017-10-09 13:05:21
【问题描述】:

我的 pom 文件:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>org.vivek.jersey.sample</groupId>
  <artifactId>vivek-jersey-sample</artifactId>
  <packaging>war</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>vivek-jersey-sample Maven Webapp</name>
  <url>http://maven.apache.org</url>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.glassfish.jersey.core</groupId>
      <artifactId>jersey-server</artifactId>
      <version>2.22.1</version>
    </dependency>
    <dependency>
      <groupId>org.glassfish.jersey.containers</groupId>
      <artifactId>jersey-container-servlet</artifactId>
      <version>2.22.1</version>
    </dependency>
  </dependencies>
  <build>
    <finalName>vivek-jersey-sample</finalName>
    <plugins>
      <plugin>
        <groupId>org.eclipse.jetty</groupId>
        <artifactId>jetty­maven­plugin</artifactId>
        <version>9.2.11.v20150529</version>
      </plugin>
    </plugins>
  </build>
</project>

当我做mvn jetty:run 时,我收到错误消息说它找不到jetty。我手动检查了网址。它们似乎有效。而且我尝试了很多版本。所有版本都失败并出现相同的错误。我可以配置jetty 手动?或者还有其他我们可以使用的服务器吗?

Exception:

[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[WARNING] The POM for org.eclipse.jetty:jetty­maven­plugin:jar:9.2.11.v20150529 is missing, no dependency information available
[WARNING] Failed to retrieve plugin descriptor for org.eclipse.jetty:jetty­maven­plugin:9.2.11.v20150529: Plugin org.eclipse.jetty:jetty­maven­plugin:9.2.11.v20150529 or one of its dependencies could not be resolved: Failure to find org.eclipse.jetty:jetty­maven­plugin:jar:9.2.11.v20150529 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced
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 6.2 kB/s)
Downloaded: https://repo.maven.apache.org/maven2/org/codehaus/mojo/maven-metadata.xml (20 kB at 8.1 kB/s)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.233 s
[INFO] Finished at: 2017-05-10T23:46:57+05:30
[INFO] Final Memory: 13M/310M
[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 (/Users/vks/.m2/repository), central (https://repo.maven.apache.org/maven2)] -> [Help 1]
org.apache.maven.plugin.prefix.NoPluginFoundForPrefixException: 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 (/Users/vks/.m2/repository), central (https://repo.maven.apache.org/maven2)]
    at org.apache.maven.plugin.prefix.internal.DefaultPluginPrefixResolver.resolve(DefaultPluginPrefixResolver.java:93)
    at org.apache.maven.lifecycle.internal.MojoDescriptorCreator.findPluginForPrefix(MojoDescriptorCreator.java:266)
    at org.apache.maven.lifecycle.internal.MojoDescriptorCreator.getMojoDescriptor(MojoDescriptorCreator.java:220)
    at org.apache.maven.lifecycle.internal.DefaultLifecycleTaskSegmentCalculator.calculateTaskSegments(DefaultLifecycleTaskSegmentCalculator.java:103)
    at org.apache.maven.lifecycle.internal.DefaultLifecycleTaskSegmentCalculator.calculateTaskSegments(DefaultLifecycleTaskSegmentCalculator.java:83)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:89)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:993)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:345)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:191)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
[ERROR] 
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/NoPluginFoundForPrefixException

【问题讨论】:

  • 运行touch /tmp/jetty.jar &amp;&amp; mvn install:install-file -DgroupId=org.eclipse.jetty -DartifactId=jetty-maven-plugin -Dversion=9.2.11.v20150529 -Dfile=/tmp/jetty.jar -Dpackaging=jar时会发生什么
  • @Raphael The POM for org.eclipse.jetty:jetty­maven­plugin:jar:9.2.11.v20150529 is missing, no dependency information available Failed to retrieve plugin descriptor for org.eclipse.jetty:jetty­maven­plugin:9.2.11.v20150529: Plugin org.eclipse.jetty:jetty­maven­plugin:9.2.11.v20150529 or one of its dependencies could not be resolved: Failure to find org.eclipse.jetty:jetty­maven­plugin:jar:9.2.11.v20150529 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced
  • 试试wget https://repo.maven.apache.org/maven2/org/eclipse/jetty/jetty-maven-plugin/9.2.11.v20150529/jetty-maven-plugin-9.2.11.v20150529.pom
  • @Raphael m on mac 所以curl "https://repo.maven.apache.org/maven2/org/eclipse/jetty/jetty-maven-plugin/9.2.11.v20150529/jetty-maven-plugin-9.2.11.v20150529.pom" 确实有效

标签: macos maven jetty maven-plugin maven-jetty-plugin


【解决方案1】:

您的插件定义有一个不正确的&lt;artifactId&gt;

改用正确的:

  <plugin>
    <groupId>org.eclipse.jetty</groupId>
    <artifactId>jetty­-maven-­plugin</artifactId>
    <version>9.4.5.v20170502</version>
  </plugin>

【讨论】:

  • 愚蠢的错误。我将内容从 pdf 复制到 vi 并且不知何故 - 不存在。谢谢
猜你喜欢
  • 2013-03-09
  • 2018-08-17
  • 2010-11-08
  • 1970-01-01
  • 2014-02-24
  • 1970-01-01
  • 1970-01-01
  • 2023-03-12
  • 1970-01-01
相关资源
最近更新 更多