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 impor开发者_运维技巧ting 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?
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.
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.
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.
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...
Got this error on running a spring roo application.
(http://repo.spring.io/spring-roo): Authorization failed for http://repo.spring.io/
Updated the repository url protocol from http
to https
to make it work.
<repository>
<id>spring-roo-repository</id>
<name>Spring Roo Repository</name>
<url>https://repo.spring.io/spring-roo</url>
</repository>
精彩评论