Maven Quickstart Archetype不存在

时间:2016-11-04 17:48:01

标签: java maven

我想用maven开始一个新项目。安装Maven 3.3.9,把它放在我的路径中,创建一个空文件夹并运行https://maven.apache.org/archetypes/maven-archetype-quickstart/中给出的命令

mvn archetype:generate -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=5-SNAPSHOT

而不是新项目,我收到了错误

E:\CODING\prj>mvn archetype:generate -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=5-SNAPSHOT
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> maven-archetype-plugin:2.4:generate (default-cli) > generate-sources @ standalone-pom >>>
[INFO]
[INFO] <<< maven-archetype-plugin:2.4:generate (default-cli) < generate-sources @ standalone-pom <<<
[INFO]
[INFO] --- maven-archetype-plugin:2.4:generate (default-cli) @ standalone-pom ---
[INFO] Generating project in Interactive mode
[INFO] Archetype repository not defined. Using the one from [org.apache.maven.archetypes:maven-archetype-quickstart:1.1] found in catalog remote
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.016 s
[INFO] Finished at: 2016-11-04T13:41:30-04:00
[INFO] Final Memory: 12M/114M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.4:generate (default-cli) on project standalone-pom: The desired archetype does not exist (org.apache.maven.archetypes:maven-archetype-quickstart:5-SNAPSHOT) -> [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/MojoFailureException

有谁知道为什么?更好的是,我如何创建一个空白的Maven项目?

3 个答案:

答案 0 :(得分:5)

同样的事情发生在我身上。这确实是一种耻辱。版本5-SNAPSHOT看起来有点奇怪。如果你放弃它,它实际上是有效的:

mvn archetype:generate -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-quickstart

您也可以在批处理模式下仅指定groupIdartifactId

mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DinteractiveMode=false

结果几乎与使用maven-archetype-quickstart原型创建相同。

有关详情,请参阅此页:Maven in 5 Minutes

答案 1 :(得分:5)

指定的版本无效。它来自2010-edited Maven example page

The most recent archetype version is 1.1(具有讽刺意味的是,也是从2010年开始),所以请尝试这样做:

mvn archetype:generate -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.1

答案 2 :(得分:1)

另一个原因,就像我的情况一样,是拼写错误,尤其是当你不熟悉这个时,一个常见的拼写错误是 archtype 而不是 archetype,这在我的情况下修复了同样的错误。< /p>