No plugin found for prefix 'jetty' in the current project
Asked Answered
S

5

29

I have added jetty mvn plugin code in my project pom.xml.

<plugin>
  <groupId>org.mortbay.jetty</groupId>
  <artifactId>maven-jetty-plugin</artifactId>
  <version>6.1.26</version>
  <configuration>
    <contextPath>/redkites</contextPath>
  </configuration>
  <executions>
    <execution>
      <id>start-jetty</id>
      <phase>deploy</phase>
      <goals>
        <goal>run</goal>
      </goals>
      <configuration>
        <scanIntervalSeconds>10</scanIntervalSeconds>
        <daemon>true</daemon>
      </configuration>
    </execution>
  </executions>
</plugin>

When I use commands sudo mvn compile and sudo mvn clean install, I didn't find any errors & build successfully, but when I type the command sudo mvn jetty:run, I'm getting an error:

[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 (/root/.m2/repository), central (http://repo.maven.apache.org/maven2)] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[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

Please suggest a way to solve it. Thank you

Stanislas answered 2/1, 2015 at 5:50 Comment(2)
Try run all the mvn commands without sudo.Charlotte
Possible duplicate of Missing Maven Plugin JettyLeninism
T
42

You may need to add org.eclipse.jetty to the list of groupIds looked up by default.

So edit your ${user.home}/.m2/settings.xml accordingly:

<pluginGroups>
  <!-- your existing plugin groups if any -->
  ...
  <pluginGroup>org.eclipse.jetty</pluginGroup>
</pluginGroups>

Quoting the Shortening the Command Line section of the plugin development guide,

... add your plugin's groupId to the list of groupIds searched by default. To do this, you need to add the following to your ${user.home}/.m2/settings.xml file:

<pluginGroups>
  <pluginGroup>sample.plugin</pluginGroup>
</pluginGroups>

Look here for more about what groupIds are looked up default:

By default, Maven will search the groupId org.apache.maven.plugins for prefix-to-artifactId mappings for the plugins it needs to perform a given build.

...

Maven will always search the following groupId's after searching any plugin groups specified in the user's settings:

  • org.apache.maven.plugins
  • org.codehaus.mojo
Tannin answered 2/1, 2015 at 15:12 Comment(0)
T
27

if you don't find the settings.xml file in your home directory

then add the default settings.xml file

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
                      http://maven.apache.org/xsd/settings-1.0.0.xsd">
  <localRepository>${user.home}/.m2/repository</localRepository>
  <interactiveMode>true</interactiveMode>
  <usePluginRegistry>false</usePluginRegistry>
  <offline>false</offline>
  <pluginGroups>
    <pluginGroup>org.eclipse.jetty</pluginGroup>
  </pluginGroups>
</settings>
Torsk answered 26/8, 2015 at 10:59 Comment(0)
J
2

That's what worked for me in a multimodule Maven project in Eclipse:

1 Open Run Configurations dialog.

2.Look at the “Base Directory:” Is there really the directory of your webapp’s submodule or is it the parent module’s directory?

3 If it is the latter, click on “Workspace” button and select the submodule’s (webapp’s) directory.

Jacks answered 22/4, 2017 at 9:25 Comment(0)
R
1

I was running the command in the directory in which the project was present but the command worked fine after switching to the one directory up i.e in one in which all the files of the project were present.

Romo answered 9/7, 2017 at 12:15 Comment(0)
I
0

Please Note:

If you are running your app using the command bellow:

mvn spring-boot:run

Make sure you are in the directory that contains the pom.xml file. Otherwise, you will run into the No plugin found for prefix 'project-name' in the current project and in the plugin groups error.

Indissoluble answered 27/2, 2019 at 19:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.