Maven mirror warehouse configuration

IDE maven configuration

Maven configuration file address: apache-maven-3.3.3\conf\setting.xml

A few points about mirror:

1.<mirrorOf>*</mirrorOf> * means that all mvn follow this mirror configuration

2.<mirrorOf>central</mirrorOf> central means the central library

3. If multiple mirrors are configured together, the first one takes effect by default.

 

默认执行的镜像:
   <mirror>
    <id>default</id>
    <url>http://xxx/repository/public/</url>
    <mirrorOf>central</mirrorOf>
  </mirror>

Switch mirror at will, no need to modify setting.xml

<mirrors>
   <!-- <mirror>
      ..其他镜像
   </mirror> -->
  <mirror>
    <id>aliyun</id>
    <url>https://maven.aliyun.com/repository/public</url>
	<mirrorOf>${aliyun}</mirrorOf>
  </mirror>
   <mirror>
    <id>default</id>
    <url>http://xxxx:8085/xxx/public/</url>
    <mirrorOf>central</mirrorOf>
  </mirror>
</mirrors>

IDE configuration 

配置mvn help:effective-settings -Daliyun=central  就可以执行aliyun的镜像了。
如果是在公司内网,不加参数直接执行 mvn install即可。

 

 

Guess you like

Origin blog.csdn.net/x18094/article/details/106580369