mvn archetype:generate issue

2.8k views Asked by At

I got this error when I was trying to create a project using Maven 3.3.3 using archetype plugin:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 27.372 s
[INFO] Finished at: 2015-06-10T10:51:23-07:00
[INFO] Final Memory: 10M/155M
[INFO] ------------------------------------------------------------------------
[ERROR] Could not find goal 'generate' in plugin org.apache.maven.plugins:maven-archetype-plugin:1.0-alpha-7 among available goals create-from-project
, create -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoNotFoundException

Any help is appreciated.

Thanks

3

There are 3 answers

1
Daniel Pokusa On

Can You write command that gives you that output?

It should looks like:

mvn archetype:generate -B -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.1 -DgroupId=com.company -DartifactId=project -Dversion=1.0-SNAPSHOT -Dpackage=com.company.project

Just try to use command above (change Your artifactId, groupId and package of course).

2
Joe On
in plugin org.apache.maven.plugins:maven-archetype-plugin:1.0-alpha-7

The current version of the plugin is 2.3, not 1.0-alpha-7.

You're either invoking it with a version number, running it from within a project that specifies a version for that plugin, or using a repository that's not in synch with Central.

First, ensure that you're invoking archetype:generate, with no additional version number.

Then, try running from a new, completely empty directory (i.e., no pom.xml).

Temporarily, move your ~/.m2 directory out of the way.

After these steps, if you're still seeing the same error, invoke maven with -X for more detailed debugging output. For example, I see:

[DEBUG] Resolved plugin version for org.apache.maven.plugins:maven-archetype-plugin
to 2.3 from repository central (https://repo1.maven.org/maven2,
default, releases+snapshots)

clearly describing how 2.3 was selected.

0
pasanbsb On

Try force update the maven meta data by adding -U.

mvn archetype:generate -DgroupId=com.company -DartifactId=project -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false -U