You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Michael Osipov <mi...@apache.org> on 2021/05/04 13:56:18 UTC

Re: How to make maven not use the first proxy in settings.xml?

Am 2021-04-25 um 10:14 schrieb Rodolphe Gohard:
> Hello,
> 
> Maven allows multiple proxies to be defined:
> 
> <!-- proxies
>     | This is a list of proxies which can be used on this machine to
> connect to the network.
>     | Unless otherwise specified (by system property or command-line
> switch), the first proxy
>     | specification in this list marked as active will be used.
>     |-->
>    <proxies>
>        <proxy>
>            <id>proxy_gcp</id>
>            <active>true</active>
>            <protocol>http</protocol>
>            <host>app-proxy.gcp.acme.fr</host>
>            <port>80</port>
>        </proxy>
>        <proxy>
>            <id>proxy_aws</id>
>            <active>false</active>
>            <protocol>http</protocol>
>            <host>app-proxy.aws.acme.fr</host>
>            <port>80</port>
>        </proxy>
>    </proxies>
> 
> As stipulated in the default settings.xml, Unless otherwise specified (by
> system property or command-line switch), the first proxy specification in
> this list marked as active will be used.
> 
> But I couldn't find any direction on how to specify otherwise by system
> property or command-line switch.
> 
> How can I tell maven to use the second proxy in the list (command line, or
> with properties) ?
> 
> Precision: I'm not looking for the -Dhttp.proxyPort=<port>
> -Dhttp.nonProxyHosts=<nonProxyHosts> options, i'm looking for a switch
> between the different defined proxies.

This is a bit of problematic topic. There is no switch for proxy 
enable/disable. I don't know where this comes from. You may try
 > <active>${FOO}</active>
and -DFOO=...

The sytem property or CLI switch only refer to -Dhttp.proxy.. and 
-Dhttps.proxy...

Note that this is a problematic solution which I don't like. This will 
only work with Wagon Apache HTTP Client because we enable this. I am 
included to remove this support in the next major for various reasons 
and all HttpURLConnection based stuff running in the same JVM. 
Everything else shall use settings.xml.

Is this sufficient as an answer? I guess am currently most skilled one 
in Maven space to answer this question. If still now clear, let me know.

Michael

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org