【发布时间】:2015-09-10 23:41:35
【问题描述】:
我在代理服务器后面使用 Maven 3.1.1。同一个代理处理HTTP 和HTTPS 流量。
我似乎无法告诉使用settings.xml 的maven 使用这两种协议。在我看来,只能有一个活动代理,因为首先定义的活动代理都会被使用,而随后的“活动”代理定义将被忽略。这是我的settings.xml:
<proxies>
<proxy>
<id>myhttpproxy</id>
<active>true</active>
<protocol>http</protocol>
<host>192.168.1.2</host>
<port>3128</port>
<nonProxyHosts>localhost</nonProxyHosts>
</proxy>
<proxy>
<id>myhttpsproxy</id>
<active>true</active>
<protocol>https</protocol>
<host>192.168.1.2</host>
<port>3128</port>
<nonProxyHosts>localhost</nonProxyHosts>
</proxy>
</proxies>
是否可以在maven的settings.xml中同时为HTTP和HTTPS配置代理?我知道我可以通过将 Java 系统属性传递给 maven 调用来解决此问题,例如:
-Dhttps.proxyHost=192.168.1.2 -Dhttps.proxyPort=3128
但这肯定可以在settings.xml内部实现?
MNG-2305 和 MNG-4394 等 Maven 错误表明此问题已解决,但我不相信。
或者,是否有一个我可以在本地运行的“代理代理”,我可以将 maven 指向? “代理代理”将相应地路由 http/https。即便如此,我仍然需要在 settings.xml 中定义两个活动代理定义,以便 Maven 引导这两种类型的流量。
【问题讨论】:
标签: java maven http https proxy