本文介绍了无法通过maven获取服务器原型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据的说明/ p>

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



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

  [INFO]扫描项目... 
[INFO]
[INFO] ---------------------------------------- --------------------------------
[INFO]建立Maven Stub项目(无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
---
下载: https://repo.maven.apache.org/maven2/org/codehaus/groovy/groovy/1.8
.3 / groovy-1.8.3.jar
[INFO] ------ -------------------------------------------------- ----------------
[INFO] BUILD FAILURE
[INFO] ------------------ -------------------------------------------------- ----
[INFO]总时间:20:12分
[INFO]完成时间:2017-02-17T10:16:15 + 08:00
[INFO]最终记忆:9M / 21M
[INFO] --------------------------------------- ---------------------------------
[错误]无法执行目标org.apache.maven。插件:maven-archetype-plugin:3
.0.0:生成(default-cli)项目独立-pom:执行default-cli
目标org.apache.maven.plugins:maven-archetype-插件:3.0.0:生成失败:在org.apache.maven.plugins中插入
:maven-archetype-plugin:3.0.0或其中一个依赖的
ies无法解决:无法解决转移工件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失败:Prema
结束内容长度分隔的消息体(预期:5522507;收到:
3244032 - > [帮助1]
[错误]
[错误]要查看错误的完整堆栈跟踪,请使用-e swit
ch重新运行Maven。
[错误]使用-X开关重新运行Maven以启用完整的调试日志记录。
[错误]
[错误]有关错误和可能解决方案的更多信息,请参阅以下文章:
[错误] [帮助1] http:// cwiki .apache.org / confluence / display / MAVEN / PluginResoluti
onException

任何人都知道怎么做修复问题?

解决方案

修改setttings.xml中的镜像将解决问题

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

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


According to instruction from Teamcity doc

I use mvn archetype:generate -DarchetypeRepository=http://download.jetbrains.com/teamcity-repository -DarchetypeArtifactId=teamcity-server-plugin -DarchetypeGroupId=org.jetbrains.teamcity.archetypes -DarchetypeVersion=RELEASE to create a project template of server-side-only plugin.

However, the error throws like below everytime I execute the mvn command.

[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

Anyone knows how to fix the issue?

解决方案

Modify the mirrors in setttings.xml will fix the problem

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

Please put above section in settings.xml

这篇关于无法通过maven获取服务器原型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-24 14:30