如何在Windows上为无头Eclipse应用程序设置代理配置

时间:2013-08-09 13:25:19

标签: eclipse proxy eclipse-rcp equinox headless-rcp

我有一个脚本需要调用一个现有的无头Eclipse应用程序(例如:p2 director application),它使用Proxy API of org.eclipse.core.net来配置对HTTP服务器的请求。

在Linux上,我可以通过设置环境变量http_proxyhttps_proxy来配置Eclipse Proxy API。

是否有类似的解决方案在Windows中从命令行配置代理?


我尝试设置由Java(http.proxyHosthttp.proxyPort等)指定的HTTP代理配置属性,但这不起作用。设置属性只会导致Eclipse的日志条目通知我系统属性被首选项中的值覆盖:

!ENTRY org.eclipse.core.net 1 0 2013-08-09 15:21:19.413
!MESSAGE System property http.proxyHost has been set to proxy by an external source. This value will be overwritten using the values from the preferences

!ENTRY org.eclipse.core.net 1 0 2013-08-09 15:21:19.414
!MESSAGE System property http.proxyPort has been set to 8080 by an external source. This value will be overwritten using the values from the preferences

所以另一种选择是无头应用程序,它允许配置首选项。该应用程序是否存在(最好是标准Eclipse发行版的一部分)?

4 个答案:

答案 0 :(得分:5)

Eclipse应用程序的代理首选项存储在文件

<eclipse-installation>/configuration/.settings/org.eclipse.core.net.prefs

因此,要么通过Eclipse首选项UI(常规/网络连接)编辑设置,然后将该文件复制到无头应用程序,要么手动创建/编辑:

eclipse.preferences.version=1
nonProxiedHosts=localhost|127.0.0.1
org.eclipse.core.net.hasMigrated=true
proxiesEnabled=true
proxyData/HTTP/hasAuth=false
proxyData/HTTP/host=<proxy.your.org>
proxyData/HTTP/port=<port>
proxyData/HTTPS/hasAuth=false
proxyData/HTTPS/host=<proxy.your.org>
proxyData/HTTPS/port=<port>
# - Set SOCKS proxy only if neccessary -
# proxyData/SOCKS/hasAuth=false
# proxyData/SOCKS/host=<proxy.your.org>
# proxyData/SOCKS/port=<port>
systemProxiesEnabled=false

HTH。

答案 1 :(得分:0)

从我所知道的,似乎在Windows中无法从命令行设置代理 - 但我真的希望其他人有更好的答案

有一个错误报告表明Eclipse忽略了Java代理配置(bug 298813)。这个错误甚至包括一个补丁,但不幸的是它被放弃了“更通用的解决方案”(bug 257443)。该错误最初是针对Eclipse 3.5计划的,但到目前为止还没有完成。

所以这看起来不太好......

答案 2 :(得分:0)

我遇到了同样的问题,我在这里和几个博客中尝试了不同的解决方案而没有一个人在为我工作。

然而......我找到的一个解决方案是,如果你有一个x32 Eclipse IDE和一个x64操作系统,设置并不总是保存,你可能会遇到这些问题。

我遇到了Juno x32 + Win7 x64这个问题,现在用Juno x64和Kepler x64解决了

因此,请检查您的OS / IDE并确保您拥有正确的版本。

It may be the same problem as this question

答案 3 :(得分:-1)

尝试使用-d(-Dhttp.proxyHost = htttp:// yourproxy和-Dhttp.proxyPort = port)将eclipse.ini文件中的相同属性(http.proxyHost和http.proxyPort)放入-vmargs部分