如何配置代理设置以便Eclipse可以下载新插件?

184

我正在使用Eclipse 3.7,在Windows XP环境下使用Web代理。

我想在一个新解压的Eclipse Indigo(Eclipse Java EE Indigo M4)上安装Groovy插件。 我将更新站点添加到可用软件站点列表中。

但是Eclipse无法检索此插件的信息,因此无法进行安装...

如果我在常规 > 网络连接中选择了本地配置,并且没有选择身份验证选项,则在尝试访问更新站点时会出现以下错误:

HTTP Proxy Authentication Required: http://dist.codehaus.org/groovy/distributions/greclipse/snapshot/e3.7/content.xml
HTTP Proxy Authentication Required: http://dist.codehaus.org/groovy/distributions/greclipse/snapshot/e3.7/content.xml
Proxy Authentication Required

所以现在,我选择了manual,为三个模式(HTTP、HTTPS、SOCKS)定义了所有正确的信息:代理、端口、身份验证、用户名和密码。 然而,当我尝试访问更新网站时,Eclipse指示他正在获取 Groovy Eclipse 的子元素,但保持在0%的状态...

奇怪的是,即使我在常规 > 网络连接配置中输入错误的密码,也没有收到任何错误消息。

我的问题:

  • 我的配置有什么问题?
  • 是否有另一种定义代理配置的方式?
  • 是否有一种方法可以获得更多的信息,知道Eclipse正在尝试做什么(workspace/.metadata/.log中没有任何有用的信息)?

另一个问题(不过较小)是修改代理设置似乎只能在重新启动Eclipse后处理。


提示1:使用我的浏览器,我可以访问更新站点,因此它没有被代理服务器阻止。

提示2:这个问题与该插件无关,因为Eclipse在安装其他插件时也会出现相同的情况。

提示3:这是启动Eclipse并尝试安装插件时workspace/.metadata/.log的内容(所有这些日志都是在启动期间编写的,在Eclipse尝试访问更新站点时没有日志记录)

!SESSION 2011-05-02 10:38:58.681 -----------------------------------------------
eclipse.buildId=I20101208-1300
java.version=1.6.0_20
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=fr_FR
Framework arguments:  -product org.eclipse.epp.package.jee.product
Command-line arguments:  -os win32 -ws win32 -arch x86 -product org.eclipse.epp.package.jee.product

!ENTRY org.eclipse.core.net 1 0 2011-05-02 10:39:02.228
!MESSAGE System property http.proxyHost is not set but should be XXX.

!ENTRY org.eclipse.core.net 1 0 2011-05-02 10:39:02.228
!MESSAGE System property http.proxyPort is not set but should be 8080.

!ENTRY org.eclipse.core.net 1 0 2011-05-02 10:39:02.244
!MESSAGE System property https.proxyHost is not set but should be XXX.

!ENTRY org.eclipse.core.net 1 0 2011-05-02 10:39:02.244
!MESSAGE System property https.proxyPort is not set but should be 8080.

!ENTRY org.eclipse.core.net 1 0 2011-05-02 10:39:02.244
!MESSAGE System property socksProxyHost is not set but should be XXX.

!ENTRY org.eclipse.core.net 1 0 2011-05-02 10:39:02.244
!MESSAGE System property socksProxyPort is not set but should be 8080.

!ENTRY org.eclipse.core.net 1 0 2011-05-02 10:39:02.244
!MESSAGE System property https.proxyHost is not set but should be XXX.

!ENTRY org.eclipse.core.net 1 0 2011-05-02 10:39:02.244
!MESSAGE System property https.proxyPort is not set but should be 8080.

!ENTRY org.eclipse.core.net 1 0 2011-05-02 10:39:02.244
!MESSAGE System property socksProxyHost is not set but should be XXX.

!ENTRY org.eclipse.core.net 1 0 2011-05-02 10:39:02.244
!MESSAGE System property socksProxyPort is not set but should be 8080.

!ENTRY org.eclipse.core.net 1 0 2011-05-02 10:39:02.244
!MESSAGE System property socksProxyHost is not set but should be XXX.

!ENTRY org.eclipse.core.net 1 0 2011-05-02 10:39:02.244
!MESSAGE System property socksProxyPort is not set but should be 8080.

!ENTRY org.eclipse.osgi 2 1 2011-05-02 10:39:02.447
!MESSAGE NLS missing message: TaskJobFactory_Refreshing_repository_configuration in: org.eclipse.mylyn.internal.tasks.ui.messages

编辑

如果我在我的eclipse.ini文件中添加以下行(由于这个原因),它就可以工作:

-Dorg.eclipse.ecf.provider.filetransfer.excludeContributors=org.eclipse.ecf.provider.filetransfer.httpclient
-Dhttp.proxyPort=8080
-Dhttp.proxyHost=XXX
-Dhttp.proxyUser=XXX
-Dhttp.proxyPassword=XXX
-Dhttp.nonProxyHosts=localhost|127.0.0.1

但是为什么?在Eclipse 3.7中这个问题还存在吗?


我有一个类似的问题:如何在Ubuntu中从代理服务器(或缓存)安装Eclipse更新?还是我应该在Ubuntu服务器上问这个问题?谢谢。 - Enrique San Martín
3
问题甚至存在于 Eclipse Neon (2017-05-12) 版本中!6年已经过去了 :O - RamValli
2
@Ram.... 还有在Eclipse Oxygen (2017-09-21)中!! - gior91
7个回答

335

我有同样的问题。我将Eclipse 3.7安装到一个新文件夹中,并创建了一个新的工作区。我使用-data参数启动Eclipse来引用新工作区。

当我尝试连接市场以获取SVN和Maven插件时,我遇到了OP中描述的相同问题。

经过几次尝试后,我清除了SOCKS协议的代理设置,然后就能够连接到市场了。

所以对我来说,解决方案是配置HTTP和HTTPS代理的手动设置,清除SOCKS的设置,然后重新启动Eclipse。


一样的情况,我曾经报告了一个错误但被忽略了。那个人基本上是说“对我而言它正常工作”。在过去的十年中,代理设置从来没有按预期工作。我必须找到某些隐藏的配置设置。 - Berlin Brown
13
实际上,即使看起来 SOCKS 值完全为空,在手动配置时,只需将 SOCKS 行突出显示,点击“清除”按钮,然后确定并重新启动 Eclipse,此问题就会突然解决。如果这不是一个 bug,我也不知道还有什么是 bug。 - DanM
非常感谢。我从来没有想到这可能是一个解决方案。我在企业防火墙内,尝试更新cleacase插件总是失败。这似乎解决了问题。 - Ayusman
3
我也遇到了这个问题,尝试了上面的步骤,但仍无法解决。我不得不编辑[eclipse安装目录]/configuration/.settings/org.eclipse.core.net.prefs并重置proxyData/SOCKS/hasAuth=false。然后按照这个答案中的步骤操作。 - Delicia Brummitt
谢谢!只有在重新启动我的Ubuntu机器后,这才对我起作用。我所做的任何设置更改都无法说服它。 - Seth
您可能还需要删除“代理绕过”规则。 - yyFred

39

手动禁用 SOCKS 对我没有用(仍然尝试使用 SOCKS,而我的公司代理拒绝了它),
本地安装 + 更改 eclipse.ini 对我有用。

-Dorg.eclipse.ecf.provider.filetransfer.excludeContributors=org.eclipse.ecf.provider.filetransfer.httpclient
-Dhttp.proxyHost=myproxy
-Dhttp.proxyPort=8080
-Dhttp.proxyUser=mydomain\myusername
-Dhttp.proxyPassword=mypassword
-Dhttp.nonProxyHosts=localhost|127.0.0.1
这些设置需要重新启动IDE(有时候需要使用-clean -refresh命令行选项)。 https://bugs.eclipse.org/bugs/show_bug.cgi?id=281472
Java8,Eclipse Neon3,缓慢的代理服务器:
-Dorg.eclipse.ecf.provider.filetransfer.excludeContributors=org.eclipse.ecf.provider.filetransfer.httpclient4
-Dhttp.proxyHost=<proxy>
-Dhttp.proxyPort=8080
-Dhttps.proxyHost=<proxy>
-Dhttps.proxyPort=8080
-DsocksProxyHost=
-DsocksProxyPort=
-Dhttp.proxyUser=<user>
-Dhttp.proxyPassword=<pass>
-Dhttp.nonProxyHosts=localhost|127.0.0.1
-Dorg.eclipse.equinox.p2.transport.ecf.retry=5
-Dorg.eclipse.ecf.provider.filetransfer.retrieve.connectTimeout=15000
-Dorg.eclipse.ecf.provider.filetransfer.retrieve.readTimeout=1000
-Dorg.eclipse.ecf.provider.filetransfer.retrieve.retryAttempts=20
-Dorg.eclipse.ecf.provider.filetransfer.retrieve.closeTimeout=1000
-Dorg.eclipse.ecf.provider.filetransfer.browse.connectTimeout=3000
-Dorg.eclipse.ecf.provider.filetransfer.browse.readTimeout=1000

5
你好,"Dorg.eclipse.ecf.provider.filetransfer.excludeContributors" 这一部分必须吗? - Daniil Shevelev
httpclient4httpclient 有什么区别? - m13r
2
已确认适用于 oxygen.2 和 3A 版本。 - DigiLive
它适用于Eclipse Oxygen,只需使用本机网络设置并将这些行添加到eclipse.ini中即可。 - user3437460

16

有一个eclipse.ini (sts.ini)参数可以帮助:

-Djava.net.useSystemProxies=true

每次更改工作环境时,都要花费大量精力来处理这些琐碎的设置...请参考eclipse bugzilla上的相关错误报告。

3
如果有其他人遇到同样的问题,需要注意使用useSystemProxies=true在Eclipse Oxygen中可能会出现问题,因为它无法正确检测环境变量https_proxy。因此,虽然HTTP网页可以正常工作,但HTTPS网页无法加载。另外请注意,一旦设置了此设置,从环境中读取的设置将覆盖Eclipse代理设置。 - Parisbre56

14

终于对我起作用了!

在Eclipse中, 依次点击 "Window" > "Preferences" > "General" > "Network Connections",
将 "Active Provider" 设置为 Native,
并将以下内容添加到eclipse.ini文件中:

-Djava.net.useSystemProxies=true
-Dhttp.proxyPort=8080
-Dhttp.proxyHost=myproxy
-Dhttp.proxyUser=mydomain\myusername
-Dhttp.proxyPassword=mypassword
-Dhttp.nonProxyHosts=localhost|127.0.0.1|192.168.*|10.*
-Dorg.eclipse.ecf.provider.filetransfer.excludeContributors=org.eclipse.ecf.provider.filetransfer.httpclient4

14

仅供讨论,作为一个可能的解决方案,我在开发一个位于公司防火墙后的Linux系统时遇到了类似的问题。然而,在使用Windows XP机器时,Eclipse可以很好地访问不同的更新站点,因为手动和本地网络连接提供程序都可以使用公司代理。

在摸索了一段时间后,我偶然看到了一个有关使用NTLMv2以及在http://cntlm.sourceforge.net/找到的实现的讨论。对于发布这个信息的人,我非常感谢,因为它帮助我解决了Linux上的问题。顺便说一下,我在Linux和Windows发行版上都使用了Eclipse 3.6.2 / Helios。

祝你好运,希望能找到解决方案!


我试过了所有其他建议,但都没用。安装CNTLM解决了问题。我使用的是Windows 7、JDK 1.7和Eclipse 4.3.2。 - slu
@slu 很高兴听到这对你有用!迄今为止,即使迁移到最新版本的JDK和Eclipse,这仍然对我有效。 - Michael
使用cntlm作为本地代理对我也起作用。我还必须禁用socks,否则luna eclipse将无法使用localhost:port。 - Bort

5

我安装了HandyCache,在通用代理链接中进行了安装。

在IE中设置代理为127.0.0.1。

在Eclipse中,依次选择“Window”>“Preferences”>“General”>“Network Connections”,将“Active Provider”设置为“Native”。


0

对我来说,我会前往\eclipse\configuration.settings\org.eclipse.core.net.prefs,手动将属性systemProxiesEnabled设置为true,然后重新启动eclipse。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接