eclipse - 如何在 Windows 上为 headless Eclipse 应用程序设置代理配置

标签 eclipse proxy eclipse-rcp equinox headless-rcp

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

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

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

我尝试设置 Java 指定的 HTTP 代理配置属性( http.proxyHosthttp.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/

相关文章:

java - HTTP 状态 500 - 实例化 servlet 类 example.webApp 时出错

hibernate - 当lazy=true 时,如何让equals() 与Hibernate 实体一起工作?

java - TableauSDK 代理设置

java - 是否可以通过传递插件名称/ID 来获取功能标签名称

java - 在 Eclipse RCP 应用程序中读取输入

android - PhoneGap 返回键功能

更新 Android SDK 后 Eclipse ADT(主题和图标)损坏

proxy - 骡子图案:web-service-proxy and pattern:http-proxy有什么区别

java - eclipse EMF : Customize XML deserialization so old project can be loaded into modified model

java - 在 Eclipse 树中的树项目旁边添加图标按钮