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?
As @khmarbaise suggested:
use many settings.xml, e.g put them in project root then
mvn package -s setings.A.xml
mvn package -s setings.B.xml
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With