Maven configuring setting XML explanation -- mirrors, proxies

Chen Bucheng I 2022-06-24 07:44:14 阅读数:596

mavenconfiguringsettingxmlexplanation

Mirrors

effect : Download Image List configured for warehouse list .

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
https://maven.apache.org/xsd/settings-1.0.0.xsd">
...
<mirrors>
<!-- Given the download image of the warehouse . -->
<mirror>
<!-- Unique identifier of the image .id Used to distinguish the different mirror Elements . -->
<id>planetmirror.com</id>
<!-- Image name -->
<name>PlanetMirror Australia</name>
<!-- The mirror URL. Building the system will give priority to using this URL, Instead of using the default server URL. -->
<url>http://downloads.planetmirror.com/pub/maven2</url>
<!-- Of the mirrored server id. for example , If we're going to set up a Maven The central warehouse (http://repo.maven.apache.org/maven2/) Mirror image , You need to set this element to central. This has to do with the id central Exactly the same . -->
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
...
</settings>

Proxies

effect : Used to configure different agents .

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
https://maven.apache.org/xsd/settings-1.0.0.xsd">
...
<proxies>
<!-- The agent element contains the information needed to configure the agent -->
<proxy>
<!-- Agent's unique definer , Used to distinguish between different agent elements . -->
<id>myproxy</id>
<!-- Whether the agent is the active one .true Then activate the agent . When we declare a group of agents , At some point, when only one agent needs to be activated , This element can be used . -->
<active>true</active>
<!-- Agency agreement . agreement :// Host name : port , Separate into discrete elements for easy configuration . -->
<protocol>http</protocol>
<!-- The host name of the agent . agreement :// Host name : port , Separate into discrete elements for easy configuration . -->
<host>proxy.somewhere.com</host>
<!-- Port of agent . agreement :// Host name : port , Separate into discrete elements for easy configuration . -->
<port>8080</port>
<!-- The user name of the agent , The user name and password represent the login name and password of the proxy authentication . -->
<username>proxyuser</username>
<!-- Agent's password , The user name and password represent the login name and password of the proxy authentication . -->
<password>somepassword</password>
<!-- List of hostnames that should not be proxied . The separator for this list is specified by the proxy server ; In the example, the vertical separator is used , It's also common to use commas to separate . -->
<nonProxyHosts>*.google.com|ibiblio.org</nonProxyHosts>
</proxy>
</proxies>
...
</settings>
copyright:author[Chen Bucheng I],Please bring the original link to reprint, thank you. https://en.javamana.com/2022/175/20210628191923978i.html