我是 Maven 的新手,我有一个疑问。是否可以在 maven 中配置多个代理?如果是这样怎么办?请举例回复。
我尝试通过在我的本地工作区中提供多个代理来找出它,但它没有用。我在任何地方都看不到正确的解释。请帮帮我。
最佳答案
请检查 Maven 站点 https://maven.apache.org/settings.html
如果您想添加多个代理,那么您需要在标签下添加所有代理。我能够添加多个代理并且它有效。
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
...
<proxies>
<proxy>
<id>myproxy</id>
<active>true</active>
<protocol>http</protocol>
<host>proxy.somewhere.com</host>
<port>8080</port>
<username>proxyuser</username>
<password>somepassword</password>
<nonProxyHosts>*.google.com|ibiblio.org</nonProxyHosts>
</proxy>
<proxy>
<id>myproxy</id>
<active>true</active>
<protocol>http</protocol>
<host>proxy.example.com</host>
<port>8080</port>
<username>proxyuser</username>
<password>somepassword</password>
<nonProxyHosts>*.google.com|ibiblio.org</nonProxyHosts>
</proxy>
</proxies>
...
</settings>
关于maven - maven中的多个代理设置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29604334/