why is there the error "No plugin found for prefix 'help' in the current project" when I write mvn help:effective-pom in the command prompt?

I'm reading a tutorial about maven and it should be mentioned that I know nothing about it. I have done first and second chapter successfully which was about it's setup. but in chapter 3 which is "Maven Pom" I have a problem. In last paragraph it says to make a "pom.xml" file in any directory you wish and write this in it:

 <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/xsd/maven-4.0.0.xsd">
   <modelVersion>4.0.0</modelVersion>

   <groupId>com.companyname.project-group</groupId>
   <artifactId>project</artifactId>
   <version>1.0</version>

</project>

and then it says that an easy way to look at the default configurations of the super POM is by running the following command: mvn help:effective-pom in the command prompt.

But when I try this, I get this error:

No plugin found for prefix 'help' in the current project

This is the tutorial I mentioned above: maven tutorial

Why there is no plugin help in my repository folder?! and how I can get it?

This is the output of mvn --version in the cmd:

Apache Maven 3.2.3
Maven home: C:\apache-maven-3.2.3
Java version: 1.6.0_13
Java home: C:\Program Files\Java\jdk1.6.0_13
Default locale: en_US, platform encoding: Cp1252
OS name: "windows Vista",version:"6.8"

This is the rezult of mvn -X help:effective-pom(first ten lines)

[INFO] Scanning for projects...
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom

[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-clean-plugin:2.5: Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:2.5
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-install-plugin/2.4/maven-install-plugin-2.4.pom

[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-install-plugin:2.4: Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-install-plugin:jar:2.4
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-resources-plugin/2.6/maven-resources-plugin-2.6.pom

[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-resources-plugin:2.6: Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.6
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-surefire-plugin/2.12.4/maven-surefire-plugin-2.12.4.pom

[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-surefire-plugin:2.12.4: Plugin org.apache.maven.plugins:maven-surefire-plugin:2.12.4 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-surefire-plugin:jar:2.12.4
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-compiler-plugin/3.1/maven-compiler-plugin-3.1.pom

[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-compiler-plugin:3.1: Plugin org.apache.maven.plugins:maven-compiler-plugin:3.1 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-compiler-plugin:jar:3.1
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-jar-plugin/2.4/maven-jar-plugin-2.4.pom

[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-jar-plugin:2.4: Plugin org.apache.maven.plugins:maven-jar-plugin:2.4 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-jar-plugin:jar:2.4
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-deploy-plugin/2.7/maven-deploy-plugin-2.7.pom

[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-deploy-plugin:2.7: Plugin org.apache.maven.plugins:maven-deploy-plugin:2.7 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-deploy-plugin:jar:2.7
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-site-plugin/3.3/maven-site-plugin-3.3.pom

Answers


Background Information

When you execute mvn help:effecitve-pom, help is a prefix which represents a specific plugin while effective-pom is the goal from that plugin that should be executed.

The first thing Maven does is try to lookup the full plugin based on the given prefix (so in your case the prefix help). Normally it does this by checking the /org/apache/maven/plugins/maven-metadata.xml file in your local repository (by default your local repository is stored under %HOME%/.m2/repository).

If this file doesn't exist then it tries to check it remotely (again default configuration would use maven central), and will then cache this file in your local repository with the following name: maven-metadata-<remote-repo-id>.xml (so for maven central it would be: maven-metadata-central.xml). If at this point it is unable to access this file remotely then it wont be able to find the plugin and will fail the build. This is exactly what you are experiencing.

Your Issue

There are two main reasons why it wont be able to resolve the plugin:

  • the local files in your repository are corrupt in some way
  • maven is unable to access the remote repository (so basically a problem with your internet connection).

You can use the debug flag -X when executing your maven build to receive more information about what is going on. For you executing the following:

mvn -X help:effective-pom

should provide information about how it is trying to resolve the plugin prefix. For example if I execute this command I see the following:

[DEBUG] Resolving plugin prefix help from [org.apache.maven.plugins, org.codehaus.mojo]
[DEBUG] Could not find metadata org.apache.maven.plugins/maven-metadata.xml in local (/home/user/.m2/repository)
[DEBUG] Skipped remote update check for org.apache.maven.plugins/maven-metadata.xml, locally cached metadata up-to-date.

My locally cached file from the remote repository is up to date so it will just use that.

Do either /org/apache/maven/plugins/maven-metadata.xml or /org/apache/maven/plugins/maven-metadata-central.xml exist in your local repository? If they don't then most likely you have an internet connection problem. If they do exist then they might be corrupt. What is the result of running with the -X flag, what information does it provide?

After all this usually the simplest solution is to delete your local repository (by default %HOME%/.m2/repository, but running maven with the -X flag will tell you exactly where it is), and execute maven again. By deleting the local repository you force maven to download everything again.


The command should work. If it doesn't, then that means you made a mistake in the setup of Maven or it printed more errors before that, namely that it could download plugins from Maven Central.

Delete the folder %HOME%/.m2/repository/ and try again. Now look closely for any problems in the output of Maven.

If it still doesn't work, show us the content of %HOME%/.m2/repository/org/apache/maven/plugins/maven-help-plugin/


Like in a similar topic in stackoverflow, just use a plugin directly in the pom, for example:

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.3</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
                <testSource>1.8</testSource>
                <testTarget>1.8</testTarget>
                <compilerArgument>-Xlint:deprecation</compilerArgument>
            </configuration>
        </plugin>
    </plugins>
</build>

If you are using a mirror of central you might need to define the prefix in the plugin metadata file for your mirror.

The file

.m2/repository/org/apache/maven/plugins/maven-metadata-<mirror id>.xml

must contain

<plugin>
   <name>Maven Help Plugin</name>
   <prefix>help</prefix>
   <artifactId>maven-help-plugin</artifactId>
</plugin>

Need Your Help

How to use async tornado API inside tornado.wsgi.WSGIContainer?

python asynchronous tornado wsgi wsgidav

I try to use custom WSGIContainer that should work with asynchronous operations:

16bit/ASM: Simple function using int 21h?

assembly x86 dos

Why isn't my 'show_msg' function working properly?