Arrow Cen
Arrow Cen

Reputation: 753

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

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?

Upvotes: 35

Views: 118562

Answers (15)

tejaspillai
tejaspillai

Reputation: 326

In case you are behind a coporate firewall, configure the proxy setting using settings.xml under <MAVEN_HOME>/conf directory.

Username, password, host & port values need to be provided.

<proxies>
    ...
    <proxy>
        <id>optional</id>
        <active>true</active>
        <protocol>http</protocol>
        <username>proxyuser</username>
        <password>proxypass</password>
        <host>proxy.host.net</host>
        <port>80</port>
        <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
    </proxy>
</proxies>

Upvotes: 11

Silvestor
Silvestor

Reputation: 60

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.

Finally the problem fixed by upgrading Java home from 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.

Upvotes: 2

Syed Zeeshan Ali
Syed Zeeshan Ali

Reputation: 397

Since Apache Maven repository URL is updated from http://repo.maven.apache.org/maven2/ to https://repo.maven.apache.org/maven2/ in NetBeans 8.2 or lower version we are facing this issue.

So what's the solution?

Solution 1:- User Terminal to download an updated maven dependencies Check out this Guide on Maven.Apache.Org

Solution 2:- Update your NetBeans, Move to Apache NetBeans 11

Upvotes: 0

Nitin Vishwakarma
Nitin Vishwakarma

Reputation: 61

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.

Upvotes: 0

hubert
hubert

Reputation: 3157

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.

Upvotes: 0

jones
jones

Reputation: 17

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

Upvotes: 0

Matthew S
Matthew S

Reputation: 1040

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

Upvotes: -2

Roberto
Roberto

Reputation: 1395

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

Upvotes: -3

Jhonatan Montes Serna
Jhonatan Montes Serna

Reputation: 11

I solved this problem disabling the antivirus for a few time while the project is create .

Click here how to do that with avast

Upvotes: 0

nilakantha singh deo
nilakantha singh deo

Reputation: 1006

  • To add Venerik's answer I would elaborate a bit for the naive users like me;

proxy settings in maven go to apache-maven-3.3.9\conf folder and find settings.xml open it in any text editor go to the block of code that looks like below

 <proxies>
<!-- proxy
 | Specification for one proxy, to be used in connecting to the network.
 |
<proxy>
  <id>optional</id>
  <active>true</active>
  <protocol>http</protocol>
  <username>proxyuser</username>
  <password>proxypass</password>
  <host>proxy.host.net</host>
  <port>80</port>
  <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
</proxy>
-->
 </proxies>
  • Now uncomment the code from (proxy.../proxy) by cutting it and pasting it

just after (proxies).

Now change according to your proxy settings In my case it looks like the following

<proxies>
  <proxy>
      <id>optional</id>
      <active>true</active>
      <protocol>http</protocol>      
      <host>authproxy.serc.iisc.ernet.in</host>
      <port>3128</port>
      <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
  </proxy>
  <!-- proxy
     | Specification for one proxy, to be used in connecting to the      network.
 |
   -->
  </proxies>

Now try running mvn archetype:generate and it should run and download

Upvotes: 1

Zheka
Zheka

Reputation: 129

In my case the solution was just run mvn archtype:generate in Safe Mode under your user profile. After that I could run it in normal boot.

Upvotes: 0

Pavan Ebbadi
Pavan Ebbadi

Reputation: 932

This is the issue with your firewall. To check if firewall is on:

Click Start-> click Run-> type wscui.cpl -> click OK. In Windows Security Center-> click Security If net work Network Firewall is "on" you need to set the proxy for maven.

Go to /conf -> open settings.xml with notepad uncomment proxy (if you don't remember proxy settings u can check in webbrowser u r using)

<proxies>
    <proxy>
        <id>optional</id>
        <active>true</active>
        <protocol>http</protocol>
        <username></username>
        <password></password>
        <host>www-proxy.us.oracle.com</host>
        <port>80</port>
        <nonProxyHosts></nonProxyHosts>
    </proxy>
</proxies>

You can leave the username and pwd fields blank and set only host and port.

Upvotes: 6

Shoket Mahmood Ahmed
Shoket Mahmood Ahmed

Reputation: 312

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

Upvotes: 2

Jesse Webb
Jesse Webb

Reputation: 45243

The other thing that could be going wrong is that your machine is behind a firewall or proxy so your box is not able to hit http://repo1.maven.org/maven2. Try accessing this URL directly in a browser or something to test if you are able to make the request.

Upvotes: 30

Jesse Webb
Jesse Webb

Reputation: 45243

The command you should be using to generate a project with an archetype is...

mvn archetype:generate

The command you posted in your question was wrong (missing the first 'e' in archetype). I assume this is just a typo in SO though because the error you posted had archetype spelled correctly.

I believe this error will occur if you are trying to execute this command from a directory that already has a pom.xml file in it. It will try to find an archetype plugin configuration inside the existing pom.xml file.

Try the command again in an empty directory, or at least in one that doesn't have a pom.xml file and it should work.

Upvotes: 18

Related Questions