【问题标题】:Failed to get the server archetype by maven无法通过 maven 获取服务器原型
【发布时间】:2017-02-17 02:23:22
【问题描述】:

根据Teamcity doc的指示

我使用mvn archetype:generate -DarchetypeRepository=http://download.jetbrains.com/teamcity-repository -DarchetypeArtifactId=teamcity-server-plugin -DarchetypeGroupId=org.jetbrains.teamcity.archetypes -DarchetypeVersion=RELEASE 创建一个仅服务器端插件的项目模板。

但是,每次执行 mvn 命令时都会抛出如下错误。

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> maven-archetype-plugin:3.0.0:generate (default-cli) > generate-source
s @ standalone-pom >>>
[INFO]
[INFO] <<< maven-archetype-plugin:3.0.0:generate (default-cli) < generate-source
s @ standalone-pom <<<
[INFO]
[INFO] --- maven-archetype-plugin:3.0.0:generate (default-cli) @ standalone-pom
---
Downloading: https://repo.maven.apache.org/maven2/org/codehaus/groovy/groovy/1.8
.3/groovy-1.8.3.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 20:12 min
[INFO] Finished at: 2017-02-17T10:16:15+08:00
[INFO] Final Memory: 9M/21M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:3
.0.0:generate (default-cli) on project standalone-pom: Execution default-cli of
goal org.apache.maven.plugins:maven-archetype-plugin:3.0.0:generate failed: Plug
in org.apache.maven.plugins:maven-archetype-plugin:3.0.0 or one of its dependenc
ies could not be resolved: Could not transfer artifact org.codehaus.groovy:groov
y:jar:1.8.3 from/to central (https://repo.maven.apache.org/maven2): GET request
of: org/codehaus/groovy/groovy/1.8.3/groovy-1.8.3.jar from central failed: Prema
ture end of Content-Length delimited message body (expected: 5522507; received:
3244032 -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[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 rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResoluti
onException

有人知道如何解决这个问题吗?

【问题讨论】:

  • 您遇到了某种互联网/代理问题。这里运行正常。
  • @JorgeCampos 感谢Jorge,下载过程不会立即停止,但可以中途下载。除此之外,我还在 .m2 文件夹中设置了代理。
  • @JorgeCampos 你能告诉我你使用的 Maven 版本吗?谢谢
  • 我在 3.2.5、3.3.3 和 3.2.9 上都测试过
  • 谢谢豪尔赫。似乎与maven版本没有关系。我会仔细检查网络设置。还是谢谢。

标签: java maven teamcity


【解决方案1】:

修改settings.xml中的镜像即可解决问题

<mirrors>
  <mirror>
    <id>google-maven-central</id>
    <name>Google Maven Central</name>
    <url>https://maven-central.storage.googleapis.com/maven2/</url>
    <mirrorOf>central</mirrorOf>
  </mirror> 
</mirrors> 

请将以上部分放在settings.xml中

【讨论】:

  • 这对我有用,谢谢。有兴趣了解为什么需要这样做。以及它如何解决“[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:3.0.0:generate”
猜你喜欢
  • 1970-01-01
  • 2012-05-03
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-01-28
  • 2019-10-19
  • 1970-01-01
相关资源
最近更新 更多