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?
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.
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.
In case you are behind coporate firewall , configure the proxy setting using "settings.xml" under /conf directory username,password,host&port values need to be provided.
|
<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>
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.
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