繁体   English   中英

Maven 3:无法执行目标org.apache.maven.plugins:maven-archetype-plugin:2.2:generate

[英]Maven 3: Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.2:generate

我正在尝试使用maven测试

mvn archetype:generate -DgroupId=org.sonatype.mavenbook -DartifactId=quickstart -Dversion=1.0-SNAPSHOT -DpackageName=org.sonatype.mavenbook -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.0 -DinteractiveMode=false

几分钟后,系统显示我:

Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/archetype/archetype-catalog/2.2/archetype-catalog-2.2.pom
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/archetype/archetype-catalog/2.2/archetype-catalog-2.2.pom (2 KB at 4.4 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/archetype/archetype-models/2.2/archetype-models-2.2.pom
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/archetype/archetype-models/2.2/archetype-models-2.2.pom (3 KB at 5.8 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/1.5.8/plexus-utils-1.5.8.pom
Downloaded: http://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/1.5.8/plexus-utils-1.5.8.pom (8 KB at 17.0 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus/2.0.2/plexus-2.0.2.pom
Downloading: http://repo.maven.apache.org/maven2/org/apache/ant/ant-parent/1.8.1/ant-parent-1.8.1.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 30:36.874s
[INFO] Finished at: Tue Feb 07 15:59:39 BRST 2012
[INFO] Final Memory: 5M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.2:generate (default-cli) on project standalone-pom: Execution default-cli of goal org.apache.maven.plugins:maven-archetype-plugin:2.2:generate failed: Plugin org.apache.maven.plugins:maven-archetype-plugin:2.2 or one of its dependencies could not be resolved: Failed to collect dependencies for org.apache.maven.plugins:maven-archetype-plugin:jar:2.2 (): Failed to read artifact descriptor for org.codehaus.plexus:plexus-utils:jar:1.5.8: Could not transfer artifact org.codehaus.plexus:plexus:pom:2.0.2 from/to central (http://repo.maven.apache.org/maven2): Read timed out -> [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/PluginResolutionException

我怎样才能解决这个问题? 提前致谢!

当我使用Idea IDE创建项目时,我也遇到了同样的问题。 使用以下方法,您可以创建独立应用程序或Web应用程序,而不会出现任何错误。

去终点站。 键入下面提到的命令并执行。

对于Web应用程序:

mvn archetype:generate -DgroupId={project-packaging} -DartifactId={project-name} -DarchetypeArtifactId=maven-archetype-webapp -DinteractiveMode=false

对于独立应用程序:

mvn archetype:generate -DgroupId={project-packaging} -DartifactId={project-name} -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false

这将通过下载相关的罐子等来创建项目结构。完成后,已创建项目结构。 打开IDE并将其指向创建的Project的Pom.xml文件。

错误是:

无法读取org.codehaus.plexus的工件描述符:plexus-utils:jar:1.5.8:无法传输工件org.codehaus.plexus:plexus:pom:2.0.2 from / to central(http:// repo。 maven.apache.org/maven2):读取超时当您的网络运行得更好时再次尝试(互联网连接更好)。 如果可以连接到http://repo.maven.apache.org/maven2,请检查ping。

可能你应该尝试在root模式下:尝试使用sudo +命令

当我的机器在防火墙(公司网络)后面并且我没有在~/.m2/settings.xml代理时,我遇到了这个问题。

相反也可能是真的,已定义代理,但您不再连接到该网络。

有关Maven的settings.xml的详细信息,请访问此处

我有同样的问题。 Maven似乎无法查看插件,在这种情况下是原型。 这是一个网络问题。 你是代理还是防火墙? 如果是,请按照此处给出的说明操作。 否则,设置防火墙权限,您也可以尝试使用sudo。

暂无
暂无

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

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