The first project built by new maven reported an error and failed to download

problem

The error is as follows: the jar package cannot be downloaded

[ERROR] Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not be resolve..

The following methods were tried:

  • Delete all the files of C:\Users\Administrator\.m2\repository (your own directory) in this directory. It's useless

  • It's useless to change setting.xml to alisource

  • It's useless to add alisource directly to pom.xml

<repositories>
    <repository>
        <id>aliyun</id>
        <name>aliyun</name>
        <url>https://maven.aliyun.com/repository/central/</url>
        <releases>
            <enabled>true</enabled>
        </releases>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
    </repository>
</repositories>

solve

Finally, at here A solution has been found

1. First of all, we need to know that IDEA comes with maven. We don't need it here. Instead, we need to go first maven Download from the official website, configure the environment variables, and then modify the configuration in IDEA, as shown in the figure below. Change the red box to your own maven path

2. Then modify the image in setting.xml to make it faster

<mirrors>
    <mirror>
        <id>alimaven</id>
        <name>aliyun maven</name>
        <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
        <mirrorOf>central</mirrorOf>
    </mirror>
    <mirror>
        <id>central</id>
        <name>Maven Repository Switchboard</name>
        <url>http://repo1.maven.org/maven2/</url>
        <mirrorOf>central</mirrorOf>
    </mirror>
    <mirror>
        <id>repo2</id>
        <mirrorOf>central</mirrorOf>
        <name>Human Readable Name for this Mirror.</name>
        <url>http://repo2.maven.org/maven2/</url>
    </mirror>
    <mirror>
        <id>ibiblio</id>
        <mirrorOf>central</mirrorOf>
        <name>Human Readable Name for this Mirror.</name>
        <url>http://mirrors.ibiblio.org/pub/mirrors/maven2/</url>
    </mirror>
    <mirror>
        <id>jboss-public-repository-group</id>
        <mirrorOf>central</mirrorOf>
        <name>JBoss Public Repository Group</name>
        <url>http://repository.jboss.org/nexus/content/groups/public</url>
    </mirror>
    <!-- Image of central warehouse in China -->
    <mirror>
        <id>maven.net.cn</id>
        <name>oneof the central mirrors in china</name>
        <url>http://maven.net.cn/content/groups/public/</url>
        <mirrorOf>central</mirrorOf>
    </mirror>
</mirrors>

3. The most critical step is that the previous download failure problems are all here. See the figure for operation

Enter Maven - > runner as shown in the figure above, and then copy and paste the following contents into VM Options to save.

-Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true -Dmaven.wagon.http.ssl.ignore.validity.dates=true

Tags: Java Maven xml SSL nexus

Posted on Wed, 13 May 2020 12:20:57 -0400 by redbrad0