Eclipse 中的“未找到前缀的插件”错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7414075/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 20:31:43  来源:igfitidea点击:

"Plugin not found for prefix" error in Eclipse

eclipsemavenjetty

提问by Evgeny A.

In Eclipse I imported a maven-based project which uses maven jetty plugin. If I run mvn jetty:runfrom command line, everything works fine. If I add a run configuration in Eclipse and try to run it, I get the error message:

在 Eclipse 中,我导入了一个使用 maven jetty 插件的基于 maven 的项目。如果我从命令行运行mvn jetty:run,一切正常。如果我在 Eclipse 中添加运行配置并尝试运行它,我会收到错误消息:

[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/eugene/.m2/repository), central (http://repo1.maven.org/maven2)] -> [Help 1]

In the Eclipe run configuration, I use:

在 Eclipe 运行配置中,我使用:

  • Base directory: ${project_loc}
  • Goal: jetty:run
  • Maven Runtime: External
  • 基本目录: ${project_loc}
  • 目标: jetty:run
  • Maven 运行时:外部

I read the [Help1] page. I don't have pluginGroup settings in maven configuration files, but I have the jetty plugin mentioned in pom.xml, so I guess everything should be fine (especially because everything works in command-line). I tried to "Run as > Maven clean" in Eclipse before executing the jetty run configuration, but it didn't help. Project compiles and passes all tests, only jetty:run does not work in Eclipse.

我阅读了 [ Help1] 页面。我在 maven 配置文件中没有 pluginGroup 设置,但是我有 pom.xml 中提到的 jetty 插件,所以我想一切都应该没问题(特别是因为一切都在命令行中工作)。在执行 jetty 运行配置之前,我尝试在 Eclipse 中“Run as > Maven clean”,但没有帮助。项目编译并通过所有测试,只有 jetty:run 在 Eclipse 中不起作用。

Please help, I'm an Eclipse & Maven newbie. Thanks in advance.

请帮忙,我是 Eclipse 和 Maven 新手。提前致谢。

回答by Raghuram

It does not work for me from command-line either.

它也不适用于我的命令行。

Can you check if it works after adding the following in settings.xmlas documented?

您可以在settings.xml按照文档添加以下内容后检查它是否有效吗?

<pluginGroups>
    <pluginGroup>org.mortbay.jetty</pluginGroup>
</pluginGroups>

Also note that there are two different versions of the plugin - the older maven jetty pluginand the newer jetty maven plugin.

另请注意,该插件有两个不同版本 - 较旧的maven jetty 插件和较新的jetty maven 插件

回答by Kelvin Hu

I met this problem too, an easier way to solve this is to edit your pom.xml, add following plugin:

我也遇到了这个问题,解决这个问题的一个更简单的方法是编辑你的pom.xml,添加以下插件:

<project>
  ...
  <build>
    <plugins>
      ...
      <plugin>
        <groupId>org.mortbay.jetty</groupId>
        <artifactId>jetty-maven-plugin</artifactId>
        <version>7.6.8.v20121106</version>
      </plugin>
      ...
    </plugins>
  </build>
  ...
</project>

Note:

注意

  1. jetty-maven-pluginis used for jetty version 7 and above, if you want jetty version 6, you should use maven-jetty-plugin

  2. for the version, you may want to have a look at hereand herefor your desired version's full name.

  1. jetty-maven-plugin用于jetty 7及以上版本,如果你想要jetty 6版本,你应该使用 maven-jetty-plugin

  2. 对于版本,您可能需要查看此处此处以获得所需版本的全名。

回答by Evgeny A.

I apologize for wasting your time. Now I looked through maven warnings which appeared in Eclipse console after I ran the run configuration. I noticed

我很抱歉浪费你的时间。现在,我查看了运行运行配置后出现在 Eclipse 控制台中的 Maven 警告。我注意到

[WARNING] Failed to retrieve plugin descriptor for Plugin [org.mortbay.jetty:maven-jetty-plugin]: null

[警告] 无法检索插件 [org.mortbay.jetty:maven-jetty-plugin] 的插件描述符:null

so it became obvious why it couldn't recognize jetty:prefix. Couple of lines above I saw a bunch of warnings about missing plugin versions. So I added a version specification for the jetty plugin (<version>entry in pom.xml) and it solved the problem. I forgot a common rule that if something breaks the first thing to check is warnings you get.

所以很明显为什么它无法识别jetty:前缀。上面几行我看到了一堆关于缺少插件版本的警告。所以我为jetty插件(<version>pom.xml中的条目)添加了一个版本规范,它解决了这个问题。我忘记了一个共同的规则,即如果出现问题,首先要检查的是您收到的警告。

回答by averasko

I've got this issue in eclipse after importing an appengine project.

导入 appengine 项目后,我在 eclipse 中遇到了这个问题。

The target:

目标:

mvn appengine:devserver

The error:

错误:

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

The problem was in the incorrect base directoryin the eclipse run configuration. When maven does not see a pom.xmlfile and is asked to run some non-standard target if fails like this as it don't know anything about the plugin that defines the target.

问题出在 eclipse运行配置中不正确的基目录中。当 maven 没有看到pom.xml文件并被要求运行一些非标准目标时,如果像这样失败,因为它对定义目标的插件一无所知。

The solution is to correct the base directoryto wherever your pom.xmlfile resides.

解决的办法是纠正基本目录到哪里你的pom.xml文件所在。

回答by Jeffrey Monte

if you following this tutorial:

如果您遵循本教程:

http://tapestry.apache.org/creating-the-skeleton-application.html

http://tapestry.apache.org/creating-the-skeleton-application.html

don't forget to follow this one crucial instruction:

不要忘记遵循这一重要说明:

Change into the newly created directory, and execute the command:

进入新创建的目录,执行命令: