Maven: How to activate inactive proxies via command line?

Viewed 1608

I have a proxy server configured for Maven via the per-user settings.xml file. The documentation snipped of the default settings.xml template suggests that it is possible to influence which of the configured proxies is used via a command-line switch:

<!-- 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.
 |-->

However, I have found no documentation whatsoever on how this is supposed to work. The Maven documentation has very much the same template, but no mention whatsoever of a command-line switch or else.

So, suppose I have a proxy configured, but marked as <active>false</active>, like in this example:

<proxies>
    <proxy>
        <id>firstProxy</id>
        <active>false</active>
        <protocol>http</protocol>
        <host>proxy.example.invalid</host>
        <port>3128</port>
    </proxy>
</proxies>

As per the comment there would be some way to for instance "activate" it, possibly giving its id or something like that. Trying the "obvious" using mvn -Dproxies.proxy.firstProxy.active=true java:compile, without success.

I'm very new to Maven and cannot shake the feeling that I am barking up the wrong tree in some way. Is what I am trying to do even possible at all—if so, can anyone point me to a description on how to do it—or am I wasting my time?

1 Answers
Related