m2eclipse 不会下载 Maven 工件
我最近安装了 eclipse 3.6.1 和 m2eclipse 插件来与我现有的 Maven 构建一起使用,但我在尝试让它工作时遇到了很多问题。
我现有的 Maven 项目可以从命令行构建良好。
将我的项目树导入 Eclipse 后,我在其中一个项目上运行了构建。它最终因以下错误而死亡:
10/18/10 2:03:02 PM PDT: [DEBUG] 无法从存储库获取资源 'org.apache.maven.wagon:wagon-file:jar:1.0-alpha-6'中央 (http://repo1.maven.org/maven2) 授权失败:传输失败:未通过代理授权
Maven 从命令行可以毫无问题地从中央下载东西。
Eclipse 能够从 sonatype 站点下载 m2eclispe 插件。
——基于此,我知道我的代理设置正在运行。
但由于某种原因 eclipse 或 m2eclipse 无法告诉 maven 正确的设置。
我检查了帖子 此处 并尝试删除 *.lastupdated 文件,但这对错误没有影响。
我该如何解决这个问题?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
Eclipse 不知道配置到您的操作系统中的代理信息。代理信息可能在系统引导期间来自引导服务器,或者手动配置到系统中。我主要使用 Linux,无法解释任何类型的 Windows 机器如何读取这些信息。
命令行中的 Maven 确实知道代理信息。命令行中的 Maven 可能具有可用于读取代理信息的 shell 运行时环境。我猜 Eclipse 会忽略这个 shell 运行时环境。
我遇到了这个问题并解决如下。要继续,您需要知道您的代理 IP 地址以及代理身份验证信息(例如用户名/密码)。您的网络或代理管理员应该可以为您提供此服务。我使用wireshark窥探了电线。
顺便说一下,eclise 的“安装新软件”和“检查更新”可能也不起作用。他们会在这之后。
此外,完成此操作后,您将需要从本地 m2 存储库中手动删除“lastUpdated”文件。我在谷歌上找不到太多关于如何使用这些文件的信息,但是当您期望下载工件时它们会妨碍您。
通过以下方式打开网络连接首选项:Windows->首选项->常规->网络连接
将活动提供程序设置为手动。
单击 HTTP 和 HTTPS(也许是 SOCKS)的复选按钮。
选择 HTTP 行并单击编辑。
提供主机 IP 地址,单击“需要身份验证”,输入用户名和密码。如果您的代理由 Windows 域管理,则用户名将类似于:DOMAIN\USERNAME。
对 HTTPS 重复此操作。
单击“确定”、“确定”、“确定”。
进城吧。
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.
遇到了同样的 eclipse m2 代理问题。
我在首选项/常规/网络连接中拥有正确的代理设置。
但这似乎根本没有帮助。
但是,当我在“settings.xml”中设置代理用户/密码后,到目前为止一切正常。
似乎首选项下的代理设置对我的情况没有影响。
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.
我有同样的症状(“安装新软件”工作正常,命令行中的 Maven 工作正常)。我不相信我的代理需要身份验证 - Eclipse 的“网络连接”页面中的“本机”提供程序显示 Auth=
false
,而我的settings.xml
有空username 和
password
元素。无论如何,我尝试从我的
settings.xml
代理配置中完全删除username
和password
元素,并删除*.lastUpdated< /code> 文件,现在 m2eclipse 看起来非常高兴。
我的理论是,如果您指定空元素,那么命令行 Maven(在我的例子中为 2.2.1)不会发送身份验证信息,因此它可以与我的代理一起使用,而 m2eclipse 中嵌入的 Maven 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 mysettings.xml
had emptyusername
andpassword
elements in the proxy configuration.Anyway, I tried removing the
username
andpassword
elements from mysettings.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.
我在 m2eclipse 中遇到了同样的问题。在验证我的项目是使用命令行 eclipse 构建的(使用“编译”目标)后,我还可以使用 m2eclipse 来构建相同的目标(使用 Run As > Maven Build... > )。但是,默认的运行方式> Maven 安装仍然失败,并显示“错误代码 407,需要代理身份验证”,这很奇怪,因为配置的代理不需要身份验证。尽管这个错误略有不同,但问题描述非常相似。
现在,当我使用命令行 Maven 来实现“安装”目标时,m2eclipse 默认构建也成功运行。我没有更改任何配置。更重要的是:一旦我运行了一次,m2eclipse 就没有任何其他依赖项的问题?!
总而言之:在我看来,m2eclipse 中存在一些缺陷,导致它在初始依赖项下载期间与代理通信时的行为有所不同。
我希望这个解决方法也适用于您......
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...
运行 spring roo 应用程序时出现此错误。
(http://repo.spring.io/spring-roo): 授权失败 < a href="http://repo.spring.io/" rel="nofollow noreferrer">http://repo.spring.io/
从
http
更新了存储库 url 协议到https
使其正常工作。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
tohttps
to make it work.