Maven is a popular project management tool, but the official library is often not connected in China, after connecting to the turtle speed can also crash you, this time you may want to search for how to speed up. Baidu search maven image will find most of the recommended Ali cloud mirror service, but Ali cloud mirror service is really good? Go to domestic each big cloud manufacturer searched below discovery to provide mirror service, which is the fastest in the end? Here’s the depth test. Major manufacturers are also chicken thieves, the keywords have also done processing such as Tencent Tencent cloud mirror Maven Tencent cloud mirror

Mirror address

  • Ali cloud maven.aliyun.com/mvn/view
  • Tencent cloud mirrors.cloud.tencent.com/
  • Huawei cloud mirrors.huaweicloud.com/

We divided the table from user experience, download speed to evaluate

The user experience

Ali cloud

  • Open ali Cloud Maven mirror urlmaven.aliyun.com/mvn/viewIt is difficult to find the specific configuration. If you are careful, you will find that there is one in the upper right cornerUse guideA link to the

  • The first part is the agent warehouse list, the second part is the configuration guide, including MVN and Gradle configuration details, directly copy the configuration tosettings.xmlfile
<mirror>
    <id>aliyunmaven</id>
    <mirrorOf>*</mirrorOf>
    <name>Ali Cloud public warehouse</name>
    <url>https://maven.aliyun.com/repository/public</url>
</mirror>
Copy the code

Tencent cloud

  • Open tencent cloud maven mirrors.cloud.tencent.com/ mirror address listed in the form of a list of all supported software source, the same document links in the upper right-hand corner is not obvious

  • The maven image acceleration configuration is also provided with the one-click replication function
<mirror>
     <id>nexus-tencentyun</id>
     <mirrorOf>*</mirrorOf>
     <name>Nexus tencentyun</name>
     <url>http://mirrors.cloud.tencent.com/nexus/repository/maven-public/</url>
 </mirror>
Copy the code

Huawei cloud

  • At first glance, the interface is very complex, but the interface is very friendly, it provides a variety of search methods, you can easily search according to the need, Maven belongs to the language class we click on the language class to view, using the form of cards to render the results. Mouse up and highlight marks, can be said to be very careful

  • Clicking maven card will prompt you to log in, register, or continue using it. It is specially emphasized here that Huawei image uses CDN acceleration and downloads twice as fast

  • The interface is also very intuitive, providing JDK download and Maven accelerated download address. Maven and Gradle can be directly switched, and detailed instructions on how to replace them. More carefully, it provides one-click download, which can directly download the complete configuration file. The novice guide links to huawei forum for more detailed guidance, one-click copy mirror address for configuration
<mirror>
    <id>huaweicloud</id>
    <mirrorOf>*</mirrorOf>
    <url>https://mirrors.huaweicloud.com/repository/maven/</url>
</mirror>
Copy the code

conclusion

Huawei cloud every step for the user’s consideration, detailed configuration instructions are better than luo luo

Download speed

Configuration File Preparation

Sample program using the previous multi-source configuration sample program, download at the end of the article

We use the configuration file downloaded by Huawei Cloud Maven image acceleration as the template and copy three copies. The mirror is designated as the address of Huawei cloud, Ali Cloud and Tencent cloud respectively. The file is named settings_ali.xml settings_huawei.xml settings_tencent

Maven’s local cache path uses the default address ${user.home}/.m2/repository. The local cache file needs to be cleaned before each build

rm -rf /root/.m2/repository/*
Copy the code

We used the Maven command line window to test by specifying specific settings.xml

The maven command is as follows

mvn clean package -Dmaven.test.skip=true -s settings_ali.xml
Copy the code

Complete script

This section uses Huawei cloud as an example to describe how to execute the script 100 times

#! /bin/bash
echo ' ' > huawei
for ((i=1; i<=100; i ++))
do
    echo $i
    rm -rf /root/.m2/repository/*
    # start_mill=$((`date '+%s'`*1000+`date '+%N'`/1000000))
    mvn clean package -Dmaven.test.skip=true -s settings_huawei.xml >> huawei
    # end_mill=$((`date '+%s'`*1000+`date '+%N'`/1000000))
    # diff=$[10#$end_mill-10#$start_mill]
    #echo $diff >> huawei
done
grep 'Total time' huawei |awk 'BEGIN {max = 0} {if ($4>max) max=$4 fi} END {print "Max=", max}'
grep 'Total time' huawei |awk 'BEGIN {min = 6553565} {if ($4<min) min=$4 fi} END {print "Min=", min}'
grep 'Total time' huawei |awk '{sum+=$4}END{print "Average = ", sum/NR}'
Copy the code

Awk was used for statistics

The results of statistical

Machine configuration: Tencent Cloud 1C2G1M

Surprisingly, the timing units were off by a notch, with Huawei cloud in seconds and others in minutes

Huawei cloud downloads averaged 20.09 seconds

Tencent cloud downloads 2 m on average

Aliyun downloads 1.23m on average

It’s easy to see which is which.

Huawei, NB.

conclusion

User experience: Huawei cloud > Tencent Cloud > Alibaba Cloud Download speed: Huawei cloud > Alibaba Cloud > Tencent Cloud

User experience does not matter one-time configuration, we will definitely choose huawei cloud with the fastest download speed.

Tip: use nohup to run the script in the background, nohup sh MVN – tceh.sh &

Please reply to MVN for the complete test code

Please reply to MVN for the complete test code

—END—