I\'m using Maven 3.1.1 behind a proxy server. The same proxy handles both HTTP
and HTTPS
traffic.
I can\'t seem to tell maven using s
I solved the problem with updating the maven version, or in other words not using the embedded eclipse maven version, but external version 3.3.9.
It works without the extra ...<id>httpsproxy</id>...
entry (as @Krzysztof Krasoń mentioned) and with it (as the asker stated).
The problem for us was, that the was obviously not working at all and to test certain things Eclipse->Maven->User Settings->[x] Update Settings
Eclipse->Maven->[x] Download repository index updates on startup
must be checked (e.g. Maven Repositories View->Global Repositories->central->Update Index
). And most of all:
Eclipse must be restarted after every settings.xml
update! :-/
I guess it's a bug or reload/caching issue. We successfully tested it with
http://
and https://
URLsMy tests with Eclipse Maven show that the protocol
in settings.xml
is referring to the protocol of the proxy server, not the protocol of the URL request. It also shows that Maven only uses the first active proxy server listed, and ignores the rest.
Here's my evidence:
1. The documentation says that
active: true if this proxy is active. This is useful for declaring a set of proxies, but only one may be active at a time.
protocol, host, port: The protocol://host:port of the proxy, separated into discrete elements."
2. The source code is even clearer:
/**
* Get the protocol of the proxy server.
* @return the protocol of the proxy server
*/
public String getProtocol()
{
return protocol;
}
3. Real world tests (using Eclipse Maven):
a. 1st proxy is a bogus ftp, 2nd is real http, 3rd is real https. Result: FAIL.
If the protocol were for the URL request, then Maven would've looked up the real http/https proxies and worked perfectly fine. Instead, it used the 1st proxy even though it was "ftp", and failed.
<proxies>
<proxy>
<id>bogus_ftp</id>
<active>true</active>
<protocol>ftp</protocol>
<port>123</port>
<host>bogus.proxy.com</host>
</proxy>
<proxy>
<id>real_http</id>
<active>true</active>
<protocol>http</protocol>
<port>123</port>
<host>real.proxy.com</host>
</proxy>
<proxy>
<id>real_https</id>
<active>true</active>
<protocol>https</protocol>
<port>123</port>
<host>real.proxy.com</host>
</proxy>
</proxies>
b. 1st proxy is real http, 2nd is bogus https. Result: SUCCESS.
This shows that it only used the 1st proxy. Otherwise, it would have used the 2nd proxy for https requests, hit the bogus proxy server, and failed.
<proxies>
<proxy>
<id>real_http</id>
<active>true</active>
<protocol>http</protocol>
<port>123</port>
<host>real.proxy.com</host>
</proxy>
<proxy>
<id>bogus_https</id>
<active>true</active>
<protocol>https</protocol>
<port>123</port>
<host>bogus.proxy.com</host>
</proxy>
</proxies>
c. Both are http, but 1st proxy is bogus, 2nd is real. Result: FAIL.
This shows that maven doesn't use multiple proxies, even for the same protocol. Otherwise, it would have tried the 2nd real proxy and succeeded.
<proxies>
<proxy>
<id>bogus_http</id>
<active>true</active>
<protocol>http</protocol>
<port>123</port>
<host>bogus.proxy.com</host>
</proxy>
<proxy>
<id>real_http</id>
<active>true</active>
<protocol>http</protocol>
<port>123</port>
<host>real.proxy.com</host>
</proxy>
</proxies>
Maven proxy from settings.xml is used for both http and https, so you just need to define one proxy server and it will be used for both, you just need to leave only one proxy
tag, like this:
<proxies>
<proxy>
<id>myhttpproxy</id>
<active>true</active>
<protocol>http</protocol>
<host>192.168.1.2</host>
<port>3128</port>
<nonProxyHosts>localhost</nonProxyHosts>
</proxy>
</proxies>
The protocol above is the protocol of the proxy server, not the proxied request.