m2eclipse wont download maven artifacts

12,055

Solution 1

Eclipse does not know the proxy information that is configured into your Operating System. The proxy information comes during boot of your system perhaps from a boot server, or is manually configured into your system. I use linux mostly and cannot explain how this information is read by a windows machine of any flavor.

Maven from the command line DOES know the proxy information. Maven from the command line perhaps has shell runtime environment available to be able to read proxy information. I guess Eclipse ignores this shell runtime environment.

I hit this problem and resolved it as follows. To proceed, you need to know your proxy ip address, and your proxy authentication information like username/password. Your network or proxy administrator should have this available for you. I snooped the wire using wireshark.

By the way, eclise's "Install New Software" and "Check For Updates" probably don't work either. They will after this.

Also, after you complete this, you will want to manually remove the 'lastUpdated' files from your local m2 repository. I can't find much info w/ google on how these files are used, but they will get in the way when you expect to download an artifact.

Open the network connections preferences this way: Windows->Preferences->General->NetworkConnections

Set Active Provider to Manual.

Click check-button for HTTP and HTTPS (maybe SOCKS).

Select HTTP line and click Edit.

Provide host ip address, click 'Requires Authentication', enter user name and password. If your proxy is managed by a windows domain, username would look like: DOMAIN\USERNAME.

Repeat for HTTPS.

Click OK, OK, OK.

Go to town.

Solution 2

Came across this same eclipse m2 problem with proxy.

I had the correct proxy settings in preferences/general/network-connections. But that didn't seem to help at all.

However, after I set my proxy user/password in "settings.xml" instead, then everything worked sofar.

It seems the proxy settings under preferences had no effect in my case.

Solution 3

I had the same symptoms ("Install new software" worked fine, Maven from command line worked fine). I don't believe my proxy requires authentication - the 'Native' provider in Eclipse's "Network Connections" page says Auth=false, and my settings.xml had empty username and password elements in the proxy configuration.

Anyway, I tried removing the username and password elements from my settings.xml proxy configuration altogether, and deleting the *.lastUpdated files, and now m2eclipse seems perfectly happy.

My theory is that if you specify empty elements then command-line Maven (2.2.1 in my case) doesn't send authentication information, so it works with my proxy, whereas perhaps the Maven 3 embedded in m2eclipse sends the auth headers, but with blank info, which gets rejected by my proxy. I haven't sniffed the traffic to confirm any of this, so it's just a hunch. Even if it's right, I'm not sure who's at fault.

Solution 4

I had the very same problem with m2eclipse. After validating my project was built with command line eclipse (using the 'compile' goal), I could also use m2eclipse to build with the same goal (using Run As > Maven Build... > ). However, the default Run As > Maven Install still failed with 'Error code 407, Proxy Authentication Required', which is weird, since the configured proxy does not require authentication. And although this error is slightly different, the problem description is quite simular.

Now when I used command line Maven with the 'install' goal, the m2eclipse default build also ran succesfully. I had not changed a single bit of configuration. What was more: once I ran this a single time, m2eclipse had no problem any additional dependencies?!

So to conclude: in my opinion there IS some flaw in m2eclipse that makes it behave differently while communicating with proxies during initial dependency download.

I hope this workaround is working for you as well...

Share:
12,055
Jon
Author by

Jon

Updated on June 04, 2022

Comments

  • Jon
    Jon about 2 years

    I recently installed eclipse 3.6.1, and the m2eclipse plugin to use with my existing maven build, but im running into a lot of problems trying to get it working.

    My existing maven project builds fine from the commandline.

    After importing my project tree into eclipse, I ran a build on one of the projects. It eventually died with this error:

    10/18/10 2:03:02 PM PDT: [DEBUG] Unable to get resource 'org.apache.maven.wagon:wagon-file:jar:1.0-alpha-6' from repository central (http://repo1.maven.org/maven2) Authorization failed: Transfer failed: Not authorized by proxy

    Maven from the command line can download stuff from central without a problem.
    Eclipse was able to download the m2eclispe plugin from the sonatype site.
    -- so based on this, I know my proxy settings are working.

    But for some reason eclipse or m2eclipse is unable to tell maven the right settings.

    I checked the post here and tried deleting the *.lastupdated files, but that had no effect on the errors.

    How do I fix this?

  • Jon
    Jon over 13 years
    as stated in my origional post: install new software does work -- otherwise I would not have been able to install the m2eclipse plugin. but I changed the proxy host name to an IP address for both http and https - error is the same. Any other ideas?
  • Jon
    Jon over 13 years
    ok - im confused here. if your proxy settings in settings.xml were not correct, how did you download any of the maven artifacts to run your build? The proxy settings in my maven settings.xml work fine to download stuff when running from the command line.
  • lee
    lee over 13 years
    Like I said I was having the exact same behavior. Command line mode and m2eclipse download worked perfectly even settings.xml with "no" username/password.
  • lee
    lee over 13 years
    It worked like a charm until some plugins just wouldn't download unless I set the user/password in the settings.xml. I even used wireshark to capture the traffic, the error returned was a 407 proxy auth error, which bascally meant according to IT, primarily login failed.