[Solved] Could not transfer artifact org.apache.maven.plugins:maven-resources-plugin:pom:2.6 from/to central

question:

Maven installation is completed, and there is no problem with the configuration of environment variables. When running MVN compile in the CMD window, an error is reported as follows:

Plugin org.apache.maven. plugins:maven-resources-plugin :2.6 or one of its dependencies could not be resolved:
Failed to read artifact descriptor for org.apache.maven. plugins:maven-resources-plugin : jar:2.6 :
Could not transfer artifact org.apache.maven. plugins:maven-resources-plugin : pom:2.6 from/to central ( https://repo.maven.apache.org/mave n2): Connect to repo.maven.apache. org:443 [repo.maven.apache.org/151.101.52.215] failed: Connection timed out: connect-> [ Help 1]

solutions:

1. It can be seen from the red font that the https://repo.maven.apache.org/maven2 Download this website to Maven resources- plugin:jar : 2.6 jar package, so my browser visited the red URL, which can be accessed to

2. I put the 2.6 Maven resources plugin jar package and POM related files from other places into the directory specified by maven, but the error is still there, and the attempt fails

3. One of the solutions to this problem found on the Internet is to add the following dependency in pom.xml. Some people have solved the problem with this method, but my problem is still the same

<dependency>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-resources-plugin</artifactId>
  <version>2.6</version>
</dependency>

4. Start to enlarge the move, and finally find a way to directly configure the settings.xml file in the conf folder of the Maven installation folder as follows:

<mirrors>

    <!-- maven official -->
    <mirror>
    <id>mirrorId</id>
    <mirrorOf>central</mirrorOf>
    <name>Human Readable Name </name>
    <url>http://repo1.maven.org/maven2/</url>
    </mirror>

</mirrors>

Finally, the problem was solved. The reason for this problem is that the network segment of China Unicom is unable to access maven.org

Similar Posts: