无法通过 Vagrant 机器的代理使用 Maven
Can't use Maven through a proxy with a Vagrant machine
我目前通过代理在他们的 DevBox (XUbuntu) 上使用 JHipster。
我将我能想到的所有内容都配置为通过代理使用它,主要是使用 vagrant-proxyconf 插件,并通过在 /etc/profile.d
内的 shell 脚本中导出 MAVEN_OPTS
。
npm install
工作正常,与 apt-get
或 Firefox 相同。
但是,mvn
、telnet
或 ping
一直给我 "Connection timed out" 错误,repo1.maven.org
或 google.com
,即使我将代理选项设置为直接mvn
的参数。
好的找到问题了...
要通过代理使用 Maven,您可以像这样设置 MAVEN_OPTS
环境变量:-Dhttp.proxyHost=<domain> -Dhttp.proxyPort=<port> -Dhttps.proxyHost=<domain> -Dhttps.proxyPort=<port>
对于代理 URL,像这样:<protocol>://<domain>:<port>
.
我只是用 <protocol>://<domain>
而不是 <domain>
...
但是 ping
和 telnet
仍然不起作用,即使设置了 HTTP(S)_PROXY
环境变量(大小写)。好吧,我真的不需要它们,所以它很奇怪但无害。
我目前通过代理在他们的 DevBox (XUbuntu) 上使用 JHipster。
我将我能想到的所有内容都配置为通过代理使用它,主要是使用 vagrant-proxyconf 插件,并通过在 /etc/profile.d
内的 shell 脚本中导出 MAVEN_OPTS
。
npm install
工作正常,与 apt-get
或 Firefox 相同。
但是,mvn
、telnet
或 ping
一直给我 "Connection timed out" 错误,repo1.maven.org
或 google.com
,即使我将代理选项设置为直接mvn
的参数。
好的找到问题了...
要通过代理使用 Maven,您可以像这样设置 MAVEN_OPTS
环境变量:-Dhttp.proxyHost=<domain> -Dhttp.proxyPort=<port> -Dhttps.proxyHost=<domain> -Dhttps.proxyPort=<port>
对于代理 URL,像这样:<protocol>://<domain>:<port>
.
我只是用 <protocol>://<domain>
而不是 <domain>
...
但是 ping
和 telnet
仍然不起作用,即使设置了 HTTP(S)_PROXY
环境变量(大小写)。好吧,我真的不需要它们,所以它很奇怪但无害。