Maven 私服配置

配置华为云私有库下载

1. settings.xml 中设置仓库凭证:servers 节点中添加如下配置

    
        releases
        ************
        ************
    
    
        snapshots
        ************
        ************
    

2. 在 profiles 节点中添加如下配置。并需要在 settings.xml 文件标签中启用。


    MyProfile
    
        
            releases
            https://devrepo.devcloud.cn-north-4.huaweicloud.com/07/nexus/content/repositories/088dbeef3980f4050f6fc007779eab60_1_0/
            
                true
            
            
                false
            
        
        
            snapshots
            https://devrepo.devcloud.cn-north-4.huaweicloud.com/07/nexus/content/repositories/088dbeef3980f4050f6fc007779eab60_2_0/
            
                false
            
            
                true
            
        
    

配置阿里云私有库下载

1. 在 settings.xml 中添加认证信息
在 Maven 默认 settings.xml 中找到 servers 的部分,添加一个 server 配置如下。


    
        rdc-releases
        ***
        ******
    
    
        rdc-snapshots
        ***
        ******
    

2. 在 profiles 节点添加如下配置, 其中 repository 是顺序搜索下载包的.


    rdc-private-repo
    
        
            rdc-releases
            https://repo.rdc.aliyun.com/repository/78947-release-CfzLQ7/
            
                true
            
            
                false
            
        
        
            rdc-snapshots
            https://repo.rdc.aliyun.com/repository/78947-snapshot-XtuBsZ/
            
                false
            
            
                true
            
        
    
    
        
            rdc-releases
            https://repo.rdc.aliyun.com/repository/78947-release-CfzLQ7/
            
                true
            
            
                false
            
        
        
            rdc-snapshots
            https://repo.rdc.aliyun.com/repository/78947-snapshot-XtuBsZ/
            
                false
            
            
                true
            
        
    

使用 properties 简化 url 配置



    
        
            huawei-yun-mirror
            central
            https://repo.huaweicloud.com/repository/maven/
        
    
    
        
            my-profile
            
                ---------YOUE_URL---------
            
            
                
                    my-repo
                    ${my.repo.url}
                
            
            
                
                    my-repo
                    ${my.repo.url}
                
            
        
    
    
        my-profile
    

拉取制品

mvn clean package

参考

  1. 华为开源镜像站软件开发服务华为云 https://mirrors.huaweicloud.com/home
  2. Maven 仓库 · 云效 Packages · 企业级制品仓库 https://packages.aliyun.com/maven
  3. Maven 查看当前生效配置、pom、环境变量等命令(mvn help用法) - https://www.jianshu.com/p/6184fa25fd53

你可能感兴趣的:(Maven 私服配置)