maven 中配置多个mirror的问题

 

 

 

公司搭建的maven私服做镜像,有使用aliyun的镜像,还有其他地方的, 默认情况下配置多个mirror的情况下,只有第一个生效。那么我们可以将最后一个作为默认值,前面配置的使用环境变量动态切换。

通过  尝试settings.xml 使用变量解决。

 

    
          central
          beijing
          http://172.16.230.111:8081/nexus/content/groups/public/
    

    
         nexus-aliyun
        central
        Nexus aliyun
        http://maven.aliyun.com/nexus/content/groups/public
   

    
         nexus
        shenyang
        Nexus-central
        http://1.1.1.1:10128/repository/maven-public/
   
  

 

默认情况下,执行: mvn help:effective-settings 可以看到使用的是私服。

使用beijing的 maven   -D(id值)=

mvn help:effective-settings -Dcentral=beijing clean

 

使用沈阳的maven  -D(id值)=

mvn help:effective-settings -Dnexus=shenyang clean

 

编译

mvn help:effective-settings -Dnexus=shenyang   -f xxxx_server/pom.xml  clean package install

 

你可能感兴趣的:(maven 中配置多个mirror的问题)