Maven-问题:Plugin org.apache.maven.plugins:maven-archetype-plugin:RELEASE or one of its dependencies..

Solve the problem of Plugin org.apache.maven.plugins:maven-archetype-plugin:RELEASE or one of its dependencies could not be resolved

Recently I was learning JAvaWeb. When I first used IDEA (unused before) to create a maven project, the creation was always unsuccessful and the file was incomplete. Below is an error message.

[WARNING] Could not transfer metadata org.apache.maven.plugins:maven-archetype-plugin/maven-metadata.xml from/to central (https://repo.maven.apache.org/maven2): Received fatal alert: protocol_version
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.282 s
[INFO] Finished at: 2019-01-05T18:29:17+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Plugin org.apache.maven.plugins:maven-archetype-plugin:RELEASE or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-archetype-plugin:jar:RELEASE: Failed to resolve version for org.apache.maven.plugins:maven-archetype-plugin:jar:RELEASE: Could not find metadata org.apache.maven.plugins:maven-archetype-plugin/maven-metadata.xml in local (E:\apache-maven-3.6.0\repository) -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException
[ERROR] Maven execution terminated abnormally (exit code 1)

This error really gave me a headache. I found a lot of solutions on the Internet but it didn’t work. Finally, I slowly figured out a solution. The principle is not very clear, but it did solve my problem, so I recorded it and shared it with you. Hope to help those in need.

1.
First, open the setting.xml in the conf folder in the maven decompression directory, and add the following warehouse location and plug-in download url (because the default is abroad, here we change it to Alibaba Cloud's domestic mirror)

<localRepository>E:\apache-maven-3.6.0\repository</localRepository>

The warehouse path is your own choice, this path needs to exist (I created a repository directly in the unzipped folder of maven)
Insert picture description here

<mirror>
      <id>alimaven</id>
      <name>aliyun maven</name>
      <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
      <mirrorOf>central</mirrorOf>       
</mirror> 

Add Alibaba Cloud's domestic mirror address.
Insert picture description here
Exit after saving.
2.
In IDEA, follow the path file-setting to find the maven configuration options (as shown in the figure below), and modify the following two items: the first item is modified to the setting.xml in the conf folder in the maven decompression directory, and the second item will be automatically Read the warehouse address in the setting.xml file (if it is not automatically read, check whether you have written it wrong), or you can manually change it. After the change is complete, click Apply-OK.
Insert picture description here
After restarting IDEA and creating a new maven project, you can find that the above error is missing.
Insert picture description here
You can play with IDEA happily~~~
If you have any questions, please communicate with me.


Continuously updating...
Article reference learning address: https://blog.csdn.net/luckytsw/article/details/85866497

Guess you like

Origin blog.csdn.net/weixin_44325444/article/details/106738913