I'm using Ubuntu with Gnome where I can set network proxy settings (with authentication).
The question is: how I can run maven in command line and make it use this proxy?
I'm using Ubuntu with Gnome where I can set network proxy settings (with authentication).
The question is: how I can run maven in command line and make it use this proxy?
Did you take a look at http://maven.apache.org/guides/mini/guide-proxies.html?
In your settings.xml:
<settings>
.
.
<proxies>
<proxy>
<active>true</active>
<protocol>http</protocol>
<host>proxy.somewhere.com</host>
<port>8080</port>
<username>proxyuser</username>
<password>somepassword</password>
<nonProxyHosts>www.google.com|*.somewhere.com</nonProxyHosts>
</proxy>
</proxies>
.
.
</settings>
There is a java.net.useSystemProxies
system property that can be set to true
(on Windows and Linux platforms) to tell the JVM to use the system proxy settings. From the Java Networking and Proxies guide:
Before we see in details how to write such a
ProxySelector
, let's talk about the default one. J2SE 5.0 provides a default implementation which enforces backward compatibility. In other terms, the defaultProxySelector
will check the system properties described earlier to determine which proxy to use. However, there is a new, optional feature: On recent Windows systems and on Gnome 2.x platforms it is possible to tell the defaultProxySelector
to use the system proxy settings (both recent versions of Windows and Gnome 2.x let you set proxies globally through their user interface). If the system propertyjava.net.useSystemProxies
is set totrue
(by default it is set tofalse
for compatibility sake), then the defaultProxySelector
will try to use these settings. You can set that system property on the command line, or you can edit the JRE installation filelib/net.properties
, that way you have to change it only once on a given system.
But this will only work for the java.net.*
classes, not for commons-httpclient, jsch, etc. So this doesn't solve the whole issue and Maven doesn't really support it (this is logged as MNG-728).
In other words, I'm afraid you'll have to configure the proxy settings in your ~/.m2/settings.xml
.