• 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私服仓库--》线上的中央仓库   

     

    写在最后

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

     相关推荐:

  • 相关阅读:
    云之家溢多利cloud审批提示"已绑定云之家,不能重复绑定"
    移动报表测试表单插件
    返回数据
    CRM发布菜单
    下推启动条件修改无效
    谷歌浏览器路径
    移动控件前端设置
    GridView中的数据导出为Excel【转】,和以前的有变化
    Ajax.net 错误 Could not load type 'Microsoft.Web.Extensions.Design.Dll'解决方法.
    WCF运行错误:“此集合已经包含方案 http 的地址”的解决办法
  • 原文地址:https://www.cnblogs.com/Marydon20170307/p/13272558.html
Copyright © 2020-2023  润新知