我有一个脚本需要调用使用 p2 director application 的现有 headless Eclipse 应用程序之一(例如: Proxy API of org.eclipse.core.net
)用于配置其对 HTTP 服务器的请求。
在 Linux 上,我可以通过设置环境变量来配置 Eclipse 代理 API http_proxy
和 https_proxy
.
在 Windows 中从命令行配置代理是否有类似的解决方案?
我尝试设置 Java 指定的 HTTP 代理配置属性( http.proxyHost
、 http.proxyPort
等),但这不起作用。设置属性只会导致来自 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
因此,另一种选择是允许配置首选项的 headless 应用程序。这个应用程序是否存在(最好是作为标准 Eclipse 发行版的一部分)?
最佳答案
Eclipse 应用程序的代理首选项存储在文件中
<eclipse-installation>/configuration/.settings/org.eclipse.core.net.prefs
因此,要么通过 Eclipse 首选项 UI(常规/网络连接)编辑设置,然后将该文件复制到 headless 应用程序,要么手动创建/编辑:
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
哈。
关于eclipse - 如何在 Windows 上为 headless Eclipse 应用程序设置代理配置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18147722/