75

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?

Michael Herold
  • 1,292
  • 1
  • 13
  • 22
Tom
  • 2,857
  • 9
  • 46
  • 59
  • 3
    Are you deleting your local maven repo? (.m2/repository) ? Usually Eclipse updates the indexes of the repository....BTW: What does long mean? Minutes? – khmarbaise Feb 16 '11 at 07:01
  • 3
    I didn't delete my maven repository.Long time means hours, for several times I have to quit my eclipse by end process. – Tom Feb 18 '11 at 05:58
  • 1
    Any chance it's slow to write to ~/.m2 (as in, maybe your home directory is on a network drive--like here at work)? – schmmd Sep 26 '11 at 17:42
  • 1
    Mine is taking for more than few hours, and it haven't completed until now, am I doing something wrong? – Wong Jia Hau Oct 12 '18 at 01:46

8 Answers8

91

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).

gvlasov
  • 18,638
  • 21
  • 74
  • 110
FrVaBe
  • 47,963
  • 16
  • 124
  • 157
21

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.

crowne
  • 8,456
  • 3
  • 35
  • 50
4

Even i was facing updating maven dependencies on eclipse startup and eclipse hangup. I found that my workspace directory do not have required permission(full permission). After i set those permission my issue got resolved.

devcodecc
  • 121
  • 1
  • 2
  • 8
3

Have you set Eclipse to use the local copy of Maven, rather than the built-in one? I've found that to be quicker. Also, make sure Eclipse is pointing to the local copy of your config file.

TrueDub
  • 5,000
  • 1
  • 27
  • 33
1

If it still takes a long time after trying all the other options, create a new workspace and move your projects to the new workspace.

DonQuijote
  • 47
  • 8
1

If you use a proxy for connect, check in your settings.xml (D:\apache-maven-3.3.3\conf) if you have set correctly the user/password.

<proxies>
    <proxy>
      <id>optional</id>
      <active>true</active>
      <protocol>http</protocol>
      <username>XXXX</username>
      <password>XXXX</password>
      <host>XXXX</host>
      <port>8080</port>
      <nonProxyHosts>XXXX</nonProxyHosts>
    </proxy>  
 </proxies>
Pichitron
  • 159
  • 5
1

I have faced the same issue but I was using the sts. I tried to replace the snapshot versions with release versions and even also I changed the embedded maven of sts to my system installed but did not found any luck. I have updated my sts to the latest and boom it is no longer taking an infinite time to download

0

You have to put Maven offline then close eclipse, reopen eclipse and put maven online again. To put maven offline : go to Preferences → Maven and check Offline

ayada
  • 412
  • 1
  • 12