简体   繁体   English

mvn原型:产生问题

[英]mvn archetype:generate issue

I got this error when I was trying to create a project using Maven 3.3.3 using archetype plugin: 当我尝试使用原型插件使用Maven 3.3.3创建项目时出现此错误:

[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). 只需尝试使用上面的命令(当然更改您的artifactId,groupId和包)。

尝试通过添加-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. 该插件的当前版本是2.3,而不是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. 您要么使用版本号调用它,要么在为该插件指定版本的项目中运行它,或者使用与Central不同步的存储库。

First, ensure that you're invoking archetype:generate , with no additional version number. 首先,请确保您正在调用archetype:generate ,而没有其他版本号。

Then, try running from a new, completely empty directory (ie, no pom.xml ). 然后,尝试从一个全新的完全空目录运行(即,没有pom.xml )。

Temporarily, move your ~/.m2 directory out of the way. 暂时将~/.m2目录移开。

After these steps, if you're still seeing the same error, invoke maven with -X for more detailed debugging output. 完成这些步骤后,如果仍然遇到相同的错误,请使用-X调用maven以获得更详细的调试输出。 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. 清楚说明如何选择2.3。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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