Tom
Tom

Reputation: 2847

Why does Eclipse take so long to update Maven dependencies?

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?

Upvotes: 76

Views: 113945

Answers (10)

Rainier Diaz
Rainier Diaz

Reputation: 65

if it gets stuck indefinitely, then switch to a different workspace

Upvotes: 0

Stefan
Stefan

Reputation: 12463

If you are stuck at

"Importing Maven projects: (89%)"

it is likely that Maven cannot download any dependencies, plugins, etc. This is never gonna end ;) Check your Maven config:

  1. Run Maven from command line including PROXY settings
  2. Eclipse preferences
    • Proxy settings
    • Maven settings

Upvotes: 0

ayada
ayada

Reputation: 501

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

Upvotes: 0

Kunal Budhiraja
Kunal Budhiraja

Reputation: 59

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

Upvotes: 1

Pichitron
Pichitron

Reputation: 169

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>

Upvotes: 2

Hrishi Jimage
Hrishi Jimage

Reputation: 21

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.

Upvotes: 2

FrVaBe
FrVaBe

Reputation: 49341

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

Upvotes: 92

devcodecc
devcodecc

Reputation: 121

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.

Upvotes: 4

crowne
crowne

Reputation: 8534

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.

Upvotes: 21

TrueDub
TrueDub

Reputation: 5070

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.

Upvotes: 3

Related Questions