maven mirror httpsrepo.maven.apache.orgmaven2 error

If you want to develop WebAPP with Visual Studio Code combined with Maven, try integrating it. According to https://blog.csdn.net/CSUstudent007/article/details/103433387 method integration. But when building a Maven project, it always prompts an error.

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

During this period, various connect timeout errors occurred. Various searches, I feel that it should be a problem of network mirroring. Found this article. https://blog.csdn.net/pkx1993/article/details/86691426 , found a solution in it. Add in the mirrors of maven's settings.xml configuration file

<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>

Build the maven project again:

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

Then download the plug-in is normal. Prompt to enter groupid and other content, and finally prompt that the build is successful:

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] ------------------------------------------------------------------------

Guess you like

Origin blog.csdn.net/m0_54883970/article/details/124297157