Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the problem of maven dependency Import failure

2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article focuses on "how to solve the problem of maven dependency import failure", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "how to solve the problem of maven dependency import failure".

Due to network problems, maven dependencies often fail to import, and the probability of failed imports on private servers is lower, while the probability of failed imports on maven central warehouse is relatively high. in fact, this problem is easy to solve, but before, many beginners did not know how to solve this problem, and some people even failed to rely on imports, which led to the failure of project dependent imports when the project could not run properly. For various reasons, I decided to write this article, like everyone to introduce that I am commonly used in solving this problem. Basically, 99% of the problems have been solved after these two moves have been played, and the remaining 1% can be solved only by repeating these two moves. Everyone is also welcome to leave a message at the end of the article to talk about your thinking in solving this problem.

Option one

First of all, after maven is installed, there will be tutorials on the Internet to replace the maven mirror station with the aliyun mirror station. Specifically, add the following configuration to the mirrors node of the setting.xml file:

Nexus-aliyun * Nexus aliyun http://maven.aliyun.com/nexus/content/groups/public

If there is no setting.xml file locally, you can create one by yourself, and the relevant nodes should be the same as the official one.

But this program is not 100% effective, I have encountered this situation before, rely on life and death to download, the mirror station has been changed to aliyun, still not, later try to comment out this configuration, change back to the default download source, it is successful, therefore, when partners encounter download failure, you can switch between the official mirror and aliyun, do not blindly believe that a certain one can be imported successfully.

Option 2

Sometimes, although the download of the dependency fails, there are many files with the suffix .lastUpdated in the related folder. At this time, if the developer imports repeatedly in the development tool, he will find that the import is always unsuccessful. At this time, you need to delete the relevant .lastUpdated file in the local repository. You can find all the files with the suffix .lastUpdated in the local repository through file search, as shown below:

Delete it all when you find it, and then re-import the dependencies in the development tool.

Be careful

After the above two schemes have been tried, the import may still fail. At this point, you only need to repeat the above steps. The problem of my current reliance on download failure has been solved through the above two steps, which has been successful all the time.

At this point, I believe you have a deeper understanding of "how to solve the problem of maven dependency import failure". 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.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report