读书人

maven 获取jar从不同的仓库搜索排序

发布时间: 2014-01-09 23:07:34 作者: rapoo

maven 获取jar从不同的仓库搜寻排序
maven仓库读取备忘录:
在setting.xml配置了镜像后首先读取镜像的仓库,在没有对应的仓库id,读取setting.xml下标签<profile>下的仓库id,如果没有相对应url或者jar, 再读取项目下
pom.xml下标签<repositories>下的仓库,如果没有相对应的url或者jar,在读取maven默认的中央仓库,如果没有就报错了!

maven 项目下 pom.xml配置仓库

<repositories> <repository>        <id>test</id>     <url>http://192.168.0.114:8081/nexus/content/groups/public/</url>         <releases>            <enabled>true</enabled>         </releases>         <snapshots>           <enabled>false</enabled>         </snapshots>             </repository> </repositories>


maven setting.xml下<profile>标签配置
<profile> <id>dev</id>       <repositories>         <repository>           <id>testrepositoryok</id>           <name>Repository for JDK 1.4 builds</name>  <url>http://192.168.0.114:8081/nexus123/content/groups/public/</url>           <layout>default</layout>           <snapshotPolicy>always</snapshotPolicy>         </repository>       </repositories>     </profile> 激活<activeProfiles>      <activeProfile>dev</activeProfile>    </activeProfiles>


maven setting.xml下<profile>标签配置
<mirrors>   <mirror>       <id>mirrorId</id>       <mirrorOf>testrepositoryok1</mirrorOf>       <name>newtec xxh Mirror</name>     <url>http://192.168.0.114:8081/nexus/content/groups/public/</url>     </mirror> </mirrors> 

读书人网 >开源软件

热点推荐