简体   繁体   中英

mvn archetype:generate issue

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

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).

尝试通过添加-U强制更新Maven元数据。

mvn archetype:generate -DgroupId=com.company -DartifactId=project -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false -U
 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 (ie, 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM