mvn archetype:generate does not work-no plugin found for prefix 'archetype'

Viewed 102633

I want to build a simple project using a existing archetype. But I can't run mvn archetype:generate as it keeps telling me the following information

[ERROR] No plugin found for prefix 'archetype' in the current project and in the
 plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the
repositories [local (C:\Documents and Settings\ccen\.m2\repository), central (ht
tp://repo1.maven.org/maven2)] -> [Help 1]

I was using MS Windows and didn't use any settings.xml in my ~/.m2 folder and all stuff is brand new. Could any one help me to figure it out?

15 Answers

Another problem with Windows (Vista ,Windows 7 onward) is that the command prompt should be running under Administrative privileges (Right click command prompt shortcut and choose "Run ad Administrator" if UAC is on), so simply run command prompt as Administrator before executing mvn archetype:generate.

I had faced this issue while creating vaadin 7 project under windows 7 using following command.

mvn archetype:generate -DarchetypeGroupId=com.vaadin -DarchetypeArtifactId=vaadin-archetype-application -DarchetypeVersion=7.1.8 -DgroupId=im.sma.testproject -DartifactId=testproject -Dversion=1.0 -Dpackaging=war
  • SMA

I was banging with this problem 2 days, I checked proxy , copied settings.xml from conf folder , deleted user local .m2 folder , came out of eclipse and installed maven directly and tried . None of the above worked.

Finallay the problem fixed by upgrading java home form 1.7 to 1.8 . My maven version is Apache Maven 3.6.3 .

Maven should report proper error for the specific issue but it is not.

Up voted the suggestion of java upgrade in this thread , previously they were down voted

Got the same issue with maven 3. I just upgraded from jdk7 to jdk8 and the issue was resolved

I have face the same problem when using maven 3.6.1 with jdk 1.7.40.

To solve this, i simply update my version of JDk to 1.8.241.

I hope this will help you.

Had same issue and the thing that worked for me was reinstalling java

  1. sudo yum install java
  2. Find the path where java is installed, you can use which java or whereis java or sudo find / -name javac

    For me, it was /usr/lib/jvm/java-11-amazon-corretto.x86_64/bin

  3. sudo vi ~/.bashrc

  4. add below lines

    export PATH=$PATH:/usr/lib/jvm/java-11-amazon-corretto.x86_64/bin

  5. source .bashrc

and then try your command - mvn archetype:generate.

If this warning is accompanied by the warning:

Received fatal alert: protocol_version

Then check your java version. I was able to solve this issue by upgrading my java version from 7 to 10. See the following:

https://github.com/technomancy/leiningen/issues/2364

I had same problem. Root cause: typed mvn generate:archetype instead archetype:generate.
mvn archetype:generate - is correct way.

Related