zoukankan      html  css  js  c++  java
  • maven 配置本地仓库、中央仓库、私库

    1.准备条件

      找到maven的安装目录--》conf目录--》settings.xml文件,例如:D:apache-maven-3.5.3conf

    2.仓库配置

      第一,本地仓库

      找到settings标签,紧挨着它就是被注释掉的localRepository标签,在这个位置配置<localRepository></localRepository>并设置仓库位置即可。例如:

    <!-- 指定maven本地仓库位置 -->
    <localRepository>D:
    epository-maven</localRepository>  

      第二,中央仓库

      找到mirrors标签,紧挨着它就是被注释掉的mirror标签,在这个位置配置<mirror></mirror>并设置仓库位置即可。例如:

    <!-- 指定中央仓库 -->
    <mirror> 
        <id>alimaven</id> 
        <name>aliyun maven</name>
        <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
        <!-- <url>http://maven.aliyun.com/nexus/content/repositories/central/</url> -->
        <mirrorOf>central</mirrorOf> 
    </mirror>

      第三,私库

      找到profiles标签,紧挨着它就是被注释掉的profile标签,在这个位置配置<profile></profile>并设置仓库位置。例如:

    <!--私服仓库配置-->  
    <profile>    
        <id>profile-nexus</id>
        <repositories>    
            <repository>    
                <id>nexus</id>    
                <url>http://192.168.57.182:8081/nexus/content/groups/public/</url>
                <snapshots><enabled>true</enabled></snapshots>    
                <releases><enabled>true</enabled></releases>    
            </repository>    
        </repositories>    
        <pluginRepositories>    
            <pluginRepository>    
                <id>nexus</id>    
                <url>http://192.168.57.182:8081/nexus/content/groups/public/</url>    
                <snapshots><enabled>true</enabled></snapshots>    
                <releases><enabled>true</enabled></releases>    
            </pluginRepository>    
        </pluginRepositories>    
    </profile>
    

      并且,需要在profiles标签体外添加activeProfiles标签,引用该私服

    </profiles>
    <!--私服仓库配置-->
    <activeProfiles>    
        <activeProfile>profile-nexus</activeProfile>
        <activeProfile>nexus</activeProfile>
    </activeProfiles>
    

      jar包下载顺序:

      本地仓库--》nexus私服仓库--》线上的中央仓库   

     

    写在最后

      哪位大佬如若发现文章存在纰漏之处或需要补充更多内容,欢迎留言!!!

     相关推荐:

  • 相关阅读:
    java
    JAVA的String 类
    JAVA的StringBuffer类
    TestLink 的使用详解
    Vertrigo Serv + testlink 环境搭建
    自动化测试全聚合
    selenium -文件上传的实现 -对于含有input element的上传
    chrome启动参数设置
    selenium
    java
  • 原文地址:https://www.cnblogs.com/Marydon20170307/p/13272558.html
Copyright © 2011-2022 走看看