Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

m2eclipse wont download maven artifacts

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?

like image 435
Jon Avatar asked Oct 18 '10 21:10

Jon


2 Answers

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.

like image 186
john franey Avatar answered Oct 16 '22 03:10

john franey


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.

like image 31
lee Avatar answered Oct 16 '22 01:10

lee