Preface
Every time I update Maven Project, I feel very uncomfortable when I see the progress bar that I can’t move forward, which obviously hinders my enthusiasm for learning.
The maven warehouse is abroad by default, and it is inevitable that it is used very slowly, especially when downloading dependencies, it is replaced with a domestic mirror, so that you can feel the flying feeling. The domestic ones that support maven images include Alibaba Cloud, Open Source China, etc., which are replaced by Alibaba Cloud.
replace
Modify the maven configuration file settings.xml (of course, you can also add a settings.xml file under the user home directory.m2)
$ cd $M2_HOME/conf/$ sudo vim settings.xml
Just add a mirror child node to the mirrors node, and the content is as follows:
<mirror> <id>nexus-aliyun</id> <mirrorOf>central</mirrorOf> <name>Nexus aliyun</name> <url>http://maven.aliyun.com/nexus/content/groups/public</url></mirror>
Just save it.
Conclusion
OK, start to enjoy 100 times the download speed
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――�
Tips:
Download the archetype-catalog.xml file, delete unnecessary skeletons, and retain the commonly used ones.
# There is no syntax error when downloading directly. $ wget http://maven.aliyun.com/nexus/content/groups/public/archetype-catalog.xml
There is one more '^M'
- archetypeCatalog is used to specify the location where maven-archetype-plugin reads archetype-catalog.xml file:
internal-maven-archetype-plugin built-in
local-local, location is ~/.m2/archetype-catalog.xml
remote--Catalog pointing to Maven central warehouse
After modifying the Alibaba Cloud image, if the command 'mvn archetype:generate -DarchetypeCatalog=local' cannot be used
$ cp ~/.m2/archetype-catalog.xml ~/.m2/repository/
Just do it.
The above is all the content of this article. I hope it will be helpful to everyone's learning and I hope everyone will support Wulin.com more.