In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how to ensure that dependent downloads no longer fail in IDEA". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to ensure that dependent downloads no longer fail in IDEA.
I. Maven setting
When we download and install Maven, if we do not modify the setting file in maven.
By default, the Maven remote central warehouse address is a foreign address.
Then our domestic network, because of the influence of mysterious forces, it will be relatively slow to access foreign addresses.
If your network is in poor condition, downloading dependent resources with the default address will be slow and may fail halfway through the download.
In this case, we can solve this problem by setting the image address of the Maven repository.
There are actually many Maven image addresses that can be used in China, such as Aliyun.
Then the configuration of this Maven image address is actually very simple.
Let's take Aliyun as an example to open the configuration tutorial on Aliyun's website.
We just need to copy this configuration into the Setting file of our installed Maven.
Aliyunmaven * Aliyun Public Warehouse https://maven.aliyun.com/repository/public
Then go back to IDEA, open the Maven settings page, set the Setting.xml file address, and then click the Override button to override the default address.
Click Save, then download the relevant dependencies again, and you will find that it will be much faster.
In fact, there is a problem here, this Maven setting is only valid for the current project.
If you want to create a new Maven project, you will find that the Maven setting in IDEA is initialized again.
That is, every time you create a new Maven project, you need to reset the Maven in IDEA.
This is more annoying!
Several times before, I ran the Maven project in IDEA and found that the package download dependency was particularly slow.
At last, it turned out that it was caused by the reinitialization of the Maven setting.
You must have encountered it under such circumstances, right?
All right, next, Brother Black will teach you two solutions.
II. Default settings
Then we use IDEA to create a new Maven project. The default settings for Maven in IDEA are as follows:
IDEA actually uses the Maven default convention address.
By default, it reads the setting.xml file from the system user's .m2 folder.
If you are a mac user, the path to the setting.xml file address is as follows:
/ Users/$ {user} /. M2/setting.xml
If you are a windows user, the path to the setting.xml file address is as follows:
CoreUsers$ {user} .m2setting.xml
This ${user} refers to the user name of your current system login.
The first solution is actually very simple.
Why don't we just move our Setting files under the address mentioned above.
If you can't beat it, join in.
After the copy has been made, the new project will load the setting.xml of the default location.
Then we have modified this file, in which the address of the warehouse is the image address we configured, so the download dependency will be very fast.
I actually use this kind of solution.
3. Default settings for new IDEA projects
Some of my friends may just want to put setting.xml in a custom place, so let's teach you another solution.
We modify some settings in IDEA, which usually only take effect for the current project, such as the Maven setting.
The IDEA can actually modify the default configuration of a new project.
After you modify the settings, all new projects will follow this setting.
Then this setting is located at:
File | New Projects Settings | Settings/Preferences for New Projects.
If you have a lower version of IDEA, the name of this setting place is different from that above.
File | Other Setting | Default Settings
Turn on this option, change the Maven settings, and then click finish.
In this way, all our new projects will use the configuration we just modified.
Create another project and open it in the project project, where the default Maven settings have been changed, so we don't need to change the configuration manually later.
At this point, I believe you have a deeper understanding of "how to ensure that dependent downloads no longer fail in IDEA". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.