maven坑-Failure to transfer org.apache.maven:maven

Reference URL: http://www.mkyong.com/maven/how-to-convert-maven-java-project-to-support-eclipse-ide/

     https://blog.csdn.net/gsycwh/article/details/52792633

Problem Description:

When creating a Maven project, an error is often reported at the first line of pom.xml, and the prompt information is as follows:

Failure to transfer org.apache.maven:maven-surefire-plugin:jar:2.5 from http:// repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven:maven- archiver:jar:2.5 from/to central (http://repo.maven.apache.org/maven2): The operation was cancelled.

problem analysis:

  The plugin of maven is not downloaded to the local

Solution 1 (preferred):

  1.Navigate to your Java project folder, where file is placed. pom.xml

    mvn eclipse:eclipse

     [ If there is an error, the reason for the error will be displayed .

  2. According to the cause of the error , you can search for the file ending with ".lastUpdated" in the local library , find a file of maven-surefire-plugin-2.7.1.pom.lastUpdated, and delete it . If not set by yourself, the local repository is C:\Users\admin\.m2\repository.

  3. mvn eclipse:eclipse 

    【success】

Solution 2:

  1. You can search the local library for files ending with ".lastUpdated", find a file of maven-surefire-plugin-2.7.1.pom.lastUpdated, and delete it. If not set by yourself, the local repository is C:\Users\admin\.m2\repository.

  2. Go back to the project, right-click on the project -> Maven -> Update Dependencies (Update Project...) to update the project, there should be nothing wrong at this time.

Notice:

  1. The maven-surefire-plugin-2.7.1.pom.lastUpdated file is not fixed, but depends on the specific information of the error. For example, in the above error message, it mainly depends on the maven: the following information.

  2. The difference between Method 1 and Method 2 is that the cause of the error is more detailed, specific and accurate.

 

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324635484&siteId=291194637