maven仓库策略

当构建Maven项目时,首先检查pom.xml文件以确定依赖包的下载位置,执行顺序如下:

1、从本地资源库中查找并获得依赖包,如果没有,执行第2步。

2、从Maven默认中央仓库中查找并获得依赖包(http://repo1.maven.org/maven2/),如果没有,执行第3步。

3、如果在pom.xml中自定义的远程仓库,那么也会在这里的仓库中进行查找并获得依赖包,如果都没有找到,那么Maven就会抛出异常。

<!-- 设定远程主仓库,按设定顺序进行查找。 -->
    <repositories>
    
        <!-- 如有Nexus私服, 取消注释并指向正确的服务器地址.
        <repository>
            <id>nexus-repos</id>
            <name>Team Nexus Repository</name>
            <url>http://192.168.11.36:8888/nexus/content/groups/public</url>
        </repository> -->
        
        <repository>
            <id>oschina-repos</id>
            <name>Oschina Releases</name>
            <url>http://maven.oschina.net/content/groups/public</url>
        </repository>
        
        <repository>
            <id>aliyun-repos</id>
            <name>aliyun Releases</name>
            <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
        </repository>
 
        <repository>
            <id>java-repos</id>
            <name>Java Repository</name>
            <url>https://maven.java.net/content/repositories/public/</url>
        </repository>
        
        <repository>
            <id>JBoss-repos</id>
            <name>JBoss Repository</name>
            <url>http://repository.jboss.org/nexus/content/groups/public/</url>
        </repository>
 
        <repository>
            <id>springsource-repos</id>
            <name>SpringSource Repository</name>
            <url>http://repo.spring.io/release/</url>
        </repository>
        
        <repository>
            <id>central-repos</id>
            <name>Central Repository</name>
            <url>http://repo.maven.apache.org/maven2</url>
        </repository>
        
        <repository>
            <id>central-repos2</id>
            <name>Central Repository 2</name>
            <url>http://repo1.maven.org/maven2/</url>
        </repository>
        
        <repository>
            <id>activiti-repos</id>
            <name>Activiti Repository</name>
            <url>https://maven.alfresco.com/nexus/content/groups/public</url>
        </repository>
        
        <repository>
            <id>activiti-repos2</id>
            <name>Activiti Repository 2</name>
            <url>https://app.camunda.com/nexus/content/groups/public</url>
        </repository>
        
        <repository> 
            <id>easonjim-repos</id> 
            <name>EasonJim Repository</name>
            <url>https://raw.github.com/easonjim/repository/master</url>
        </repository>
        
    </repositories>

 

posted @ 2020-05-17 19:18  Water540  阅读(362)  评论(0编辑  收藏  举报