Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does Eclipse take so long to update Maven dependencies?

Tags:

eclipse

maven

I have a Maven project in my Eclipse workspace. When I start Eclipse, it takes a very long time to update Maven dependencies. It actually seems like it will never finish and while it is doing this update, I can't do anything in Eclipse.

Can anybody help me?

like image 666
Tom Avatar asked Feb 16 '11 04:02

Tom


People also ask

How do I force Maven to download dependencies in Eclipse?

Via the Maven index, you can search for dependencies, select them and add them to your pom file. To download the index, select Windows > Preferences > Maven and enable the Download repository index updates on startup option. After changing this setting, restart Eclipse. This triggers the download of the Maven index.

Why Maven dependencies are not getting downloaded?

Maven uses HTTP to download its dependencies along with the dependencies of the Maven project (such as Camel). If you run Maven and it fails to download your required dependencies it's likely to be caused by your local firewall & HTTP proxy configurations.


2 Answers

If this happens on eclipse start, it is maybe not the dependecy update of your project but the Maven repository index update (as khmarbaise mentioned in his comment).

You can disable this here: PreferencesMavenDownload repository index updates on startup

A fresh index offers you an up to date list of dependencies, e.g. in the Add Dependency dialog. But I found it will do if the index is updated manually (as needed) in the Maven Repositories View.

Update: Since Eclipse Luna the index update is now disabled by default (see Bug404417).

like image 70
FrVaBe Avatar answered Sep 23 '22 11:09

FrVaBe


First check all of your dependencies including plugins and children in the dependency tree,
try to replace snapshot versions with release versions,
as snapshot versions will always look for a later update, whereas
release versions are deemed to be stable and updates are not expected for the same version number.

Secondly, assuming that you are working on a LAN, I would suggest that you install a local maven repository manager such as Nexus, and then redirect your artifact requests by setting
<mirrorOf>*</mirrorOf> in your ${user.home}/.m2/settings.xml

This will enable your downloads to be resolved quickly against a local mirror, rather than continually checking against repositories on the internet.

like image 37
crowne Avatar answered Sep 24 '22 11:09

crowne