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里面加入


	  
        
            alimaven
           central
            aliyun maven
            https://maven.aliyun.com/nexus/content/repositories/central/
         
        
        
            repo1
             central
            Human Readable Name for this Mirror.
            http://repo1.maven.org/maven2/
         
         
         
             repo2
             central
             Human Readable Name for this Mirror.
             http://repo2.maven.org/maven2/
         
  

再次构建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] ------------------------------------------------------------------------

你可能感兴趣的:(java,java,后端)