Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Plugin not found for prefix" error in Eclipse

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

[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:

  • Base directory: ${project_loc}
  • Goal: jetty:run
  • Maven Runtime: External

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.

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

like image 583
Evgeny A. Avatar asked Sep 14 '11 09:09

Evgeny A.


2 Answers

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

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

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

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

like image 88
Raghuram Avatar answered Nov 11 '22 13:11

Raghuram


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

<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-plugin is 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 here and here for your desired version's full name.

like image 10
Kelvin Hu Avatar answered Nov 11 '22 14:11

Kelvin Hu