maven mirror httpsrepo.maven.apache.orgmaven2 错误

想用Visual Studio Code结合Maven开发WebAPP,就集成一下试试。按照https://blog.csdn.net/CSUstudent007/article/details/103433387方法集成。但是构建Maven项目时候,老是提示错误。

https://repo.maven.apache.org/maven2/.error=Could not transfer artifact org.apache.maven.plugins:maven-archetype-plugin:pom:3.1.2 from/to central (https://repo.maven.apache.org/maven2): Transfer failed for https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-archetype-plugin/3.1.2/maven-archetype-plugin-3.1.2.pom

期间还出先各种 connect timeout错误。各种搜索,感觉应该是网络镜像的问题。找到了这篇文章。https://blog.csdn.net/pkx1993/article/details/86691426,在里面找到了解决方法。在maven的settings.xml配置文件mirrors里面加入

<mirrors>
	  <!-- 阿里云仓库 -->
        <mirror>
            <id>alimaven</id>
           <mirrorOf>central</mirrorOf>
            <name>aliyun maven</name>
            <url>https://maven.aliyun.com/nexus/content/repositories/central/</url>
         </mirror>
        <!-- 中央仓库1 -->
        <mirror>
            <id>repo1</id>
             <mirrorOf>central</mirrorOf>
            <name>Human Readable Name for this Mirror.</name>
            <url>http://repo1.maven.org/maven2/</url>
         </mirror>
         <!-- 中央仓库2 -->
         <mirror>
             <id>repo2</id>
             <mirrorOf>central</mirrorOf>
             <name>Human Readable Name for this Mirror.</name>
             <url>http://repo2.maven.org/maven2/</url>
         </mirror>
  </mirrors>

再次构建maven项目:

mvn org.apache.maven.plugins:maven-archetype-plugin:3.1.2:generate -DarchetypeArtifactId="maven-archetype-webapp" -DarchetypeGroupId="org.apache.maven.archetypes" -DarchetypeVersion="1.4"

然后下载插件都正常了。提示输入groupid等内容,最后提示构建成功:

Define value for property 'groupId': QMapWS
Define value for property 'artifactId': QMapWS
Define value for property 'version' 1.0-SNAPSHOT: : 1.0-SNAPSHOT
Define value for property 'package' QMapWS: :
Confirm properties configuration:
groupId: QMapWS
artifactId: QMapWS
version: 1.0-SNAPSHOT
package: QMapWS
 Y: : Y
[INFO] ----------------------------------------------------------------------------
[INFO] Using following parameters for creating project from Archetype: maven-archetype-webapp:1.4
[INFO] ----------------------------------------------------------------------------
[INFO] Parameter: groupId, Value: QMapWS
[INFO] Parameter: artifactId, Value: QMapWS
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] Parameter: package, Value: QMapWS
[INFO] Parameter: packageInPathFormat, Value: QMapWS
[INFO] Parameter: package, Value: QMapWS
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] Parameter: groupId, Value: QMapWS
[INFO] Parameter: artifactId, Value: QMapWS
[INFO] Project created from Archetype in dir: E:Maven-WorkspaceQMapWSQMapWS
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  04:24 min
[INFO] Finished at: 2020-04-23T10:13:20+08:00
[INFO] ------------------------------------------------------------------------
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值