pom.xml和settings.xml的下载优先级


一、区别

指令打包:mvn package, 

    先加载pom.xml的repositories,再加载setttings.xml中的mirrors,即先从pom.xml中的url下载,若没有再从settings.xml中的url下载

idea下载(有一个坑,若配置过maven的settings.xml,此时的settings.xml文件名不为setttings.xm则idea识别不到,会使用默认的settings.xml,这和myeclipse不同)

  只加载setttings.xml中的mirrors,不加载pom.xml的repositories  

 

二、配置

setting.xml的仓库下载配置如下

1 <mirrors>
2   <mirror>
3     <id>alimaven</id>
4     <mirrorOf>central</mirrorOf>
5     <name>aliyun maven</name>
6            <url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
7   </mirror>
8 </mirrors>
settings.xml

 

pom.xml的仓库下载配置如下

1 <repositories>
2     <repository>
3         <id>alimaven</id>
4         <name>central</name>
5         <url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
6     </repository>
7 </repositories>
pom.xml

 

三、外网迁内网时,maven仓库的jar导入不了

 

1 <mirror>
2     <id>local</id>
3     <mirrorOf>*</mirrorOf>
4     <name>local</name>
5     <url>file://d:\\repo\maven</url>
6 </mirror>
settings.xml

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM