As we all know, one of the headaches in development within the wall is that the connection speed of the Maven warehouse is too slow. Although for many Internet companies and large and medium-sized software companies, building a mirror is a matter of minutes. But it is indeed a problem for individual developers and small companies. There was a while ago that open source China provided maven warehouse images, but they are no longer available.
Below is the test record of the senior brother
Modify the setting.xml file in the conf folder in the root directory of maven. If you modify the storage location of the default repository like me, that is, there is no local repository under the .m2 folder, but there is a setting.xml file, then modify this file.
The specific content and diagrams are as follows:
<mirror> <id>alimaven</id> <name>aliyun maven</name> <url>http://maven.aliyun.com/nexus/content/groups/public/</url> <mirrorOf>central</mirrorOf> </mirror>
Then compare the two pictures to see the download speed. Each company has a speed limit of 2M bandwidth.
As mentioned above, I did see downloading things on aliyun.com.
Then, looking at the download speed, it only took a little more than ten minutes to download it. I talked about QQ in the middle and it was over when I came back. It must be about ten minutes.
Finally, there is a comparison diagram of the original warehouse of the project and the newly downloaded warehouse:
I found that there are still many jar packages that have not been downloaded, which is probably related to the configuration in the pom.xml file.
Then, let’s compare the log4j.jar folder in it specifically; the specific figure is as follows: It means I can’t understand it. I also first read this maven, but I haven’t finished it yet. Although the project is using maven, it is not very clear.
If any big brother knows the difference in the comparison picture below, please give me some advice.
The configuration of pom.xml for log4j is as follows: It seems that nothing special, the problem should not be doing this.
<dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>1.2.17</version> </dependency>
In the picture, on the left is the local repository newly downloaded from Alibaba Cloud. Why is there no jar package? The difference is a bit big.
The reason is temporarily considered as follows: (If not corrected)
Either it does not have a remote repository or it has not been downloaded. It is indeed downloaded to the local repository based on the dependencies in the pom.
(I just tested it again, and just simply add a dependency in the pom.xml file, that is, introduce a package.)
On this website, search for dependencies in the pom.xml file. http://mvnrepository.com
Then add the above dependencies in the pom.xml file; that is, the selected part in the blue and then automatically download it to the local repository, for example, the specific example is shown below;
3.5 This folder is automatically created and downloaded after modifying the pom.xml file. Then the files inside are complete. Contains jar package file.
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.