欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Could not transfer metadata org.apache.maven.plugins:maven-archetype-plugin/maven-metadata.xml from/

程序员文章站 2022-06-06 16:08:01
...

控制输出台

“C:\Program Files (x86)\Java\jdk1.8.0_144\bin\java.exe” -Dmaven.multiModuleProjectDirectory=C:\Users\Administrator\AppData\Local\Temp\archetypetmp “-Dmaven.home=D:\software\idea\IntelliJ IDEA 2018.1.5\plugins\maven\lib\maven3” “-Dclassworlds.conf=D:\software\idea\IntelliJ IDEA 2018.1.5\plugins\maven\lib\maven3\bin\m2.conf” -Dfile.encoding=UTF-8 -classpath “D:\software\idea\IntelliJ IDEA 2018.1.5\plugins\maven\lib\maven3\boot\plexus-classworlds-2.5.2.jar” org.codehaus.classworlds.Launcher -Didea.version=2018.1.5 -DinteractiveMode=false -DgroupId=wechat -DartifactId=wechat.cn -Dversion=1.0-SNAPSHOT -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-webapp -DarchetypeVersion=RELEASE org.apache.maven.plugins:maven-archetype-plugin:RELEASE:generate
[INFO] Scanning for projects…
Downloading: http://10.1.89.21:8081/nexus/content/groups/public/org/apache/maven/plugins/maven-archetype-plugin/maven-metadata.xml
[WARNING] Could not transfer metadata org.apache.maven.plugins:maven-archetype-plugin/maven-metadata.xml from/to alimaven (http://10.1.89.21:8081/nexus/content/groups/public/): Connect to 10.1.89.21:8081 [/10.1.89.21] failed: Connection timed out: connect
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 27.672 s
[INFO] Finished at: 2019-04-12T14:09:32+08:00
[INFO] Final Memory: 6M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] Plugin org.apache.maven.plugins:maven-archetype-plugin:RELEASE or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-archetype-plugin:jar:RELEASE: Failed to resolve version for org.apache.maven.plugins:maven-archetype-plugin:jar:RELEASE: Could not find metadata org.apache.maven.plugins:maven-archetype-plugin/maven-metadata.xml in local (D:\software\maven\maven-repository) -> [Help 1]

问题产生原因

报错信息中有这句话: Connection to http://repo.maven.apache.org refused.说明电脑访问不了maven repository

解决方法

maven默认仓库在国外,下载速度慢,所以需要在setting.xml文件中配置镜像.这里用的是阿里云镜像
步骤: 找到maven使用的setting文件 — 找到< mirrors> < /mirrors>选项,在里面添加以下代码

<mirror>
  <id>alimaven</id>
  <name>aliyun maven</name>
  <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
  <mirrorOf>central</mirrorOf>        
</mirror>
相关标签: maven setting.xml