Why does the error "No plugin for the" Help "prefix in the current project" appear when I write mvn help: effective-pom on the command line?

I am reading a tutorial about maven and it should be mentioned that I don't know anything about it. I have successfully completed the first and second chapters, which were about configuration. but in chapter 3 which is "Maven Pom" I have a problem. The last paragraph says to make a file "pom.xml" in any directory and write it 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 he says that an easy way to look at the default configuration for the super POM is to run the following command: mvn help:effective-pom

on the command line.

But when I try to do 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 are there no plugins in my repository folder? and how can i get it?

This is the output of mvn -version in 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 result 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

      

+2


source to share


4 answers


Background information

When you execute mvn help:effecitve-pom

, help

is a prefix that represents a specific plugin, and effective-pom

is the target of that plugin to be executed.

The first thing Maven does is try to find a complete plugin based on the given prefix (so in your case, the prefix help

). This is usually done by checking out the file /org/apache/maven/plugins/maven-metadata.xml

in your local repository (by default, your local repository is stored in %HOME%/.m2/repository

).

If this file does not exist, it tries to check it remotely (otherwise the default setting will use maven central) and then caches 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 the moment he cannot access this file remotely, then he cannot find the plugin and cannot build. This is exactly what you are experiencing.

Your question

There are two main reasons why it won't be able to resolve the plugin:

  • the local files in your repository are corrupted in some way.
  • maven cannot access the remote repository (it is basically a problem with your internet connection).


You can use the debug flag -X

while doing your maven build for more information on what's going on. To do the following:

mvn -X help:effective-pom

      

should provide information on how it tries to resolve the plugin prefix. For example, if I run 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 it.

Does your local repository have either /org/apache/maven/plugins/maven-metadata.xml

or /org/apache/maven/plugins/maven-metadata-central.xml

? If not, then most likely you have a problem with your internet connection. If they do exist, they can be corrupt. What is the result of working with the flag -X

, what information does it provide?

In the end, usually the easiest solution is to delete the local repository (by default %HOME%/.m2/repository

, but running maven with a flag -X

will tell you exactly where) and run maven again. By deleting the local repository, you are forcing maven to download everything again.

+4


source


The team must work. If this is not the case, then you made a mistake in configuring Maven or typed more errors before, namely to download plugins from Maven Central.

Delete the folder %HOME%/.m2/repository/

and try again. Now take a close look at any issues with Maven exiting.



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

+1


source


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

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>

      

0


source


As in a similar topic on stackoverflow, just use the 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>

      

0


source







All Articles