title: How to publish jars to multiple artifactory?
body: <p>I am trying to publish the same jar to 2 different jfrog artifactory.</p>
  <p>My build.gradle is:</p>
  <pre><code>buildscript {
    repositories {
      mavenCentral()
    }
    dependencies {
      classpath &quot;org.jfrog.buildinfo:build-info-extractor-gradle:latest.release&quot;
    }
  }
  
  apply plugin: &quot;com.jfrog.artifactory&quot;
  apply plugin: 'java'
  apply plugin: 'base'
  apply plugin: 'maven-publish'
  apply plugin: 'eclipse'
  apply from: &quot;${rootProject.projectDir}/gradle/properties.gradle&quot;
  
  
  artifactory {
          contextUrl = &quot;${artifactory_contextUrl_1}&quot;
          resolve {
                  repository {
                          repoKey = &quot;${artifactory_resolve_repo_1}&quot;
                          username = &quot;${artifactory_user_1}&quot;
                          password = &quot;${artifactory_password_1}&quot;
                  }
          }
      publish {
          repository {
              repoKey = &quot;${artifactory_publish_repo_1}&quot;
              username = &quot;${artifactory_user_1}&quot;
              password = &quot;${artifactory_password_1}&quot;
          }
          defaults { publications('mavenJava') }
      }
  }
  
  artifactory {
      contextUrl = &quot;${artifactory_contextUrl_2}&quot;
      resolve {
          repository {
              repoKey = &quot;${artifactory_resolve_repo_2}&quot;
              username = &quot;${artifactory_user_2}&quot;
              password = &quot;${artifactory_password_2}&quot;
             
          }
      }
      publish {
          repository {
              repoKey = &quot;${artifactory_publish_repo_2}&quot;
              username = &quot;${artifactory_user_2}&quot;
              password = &quot;${artifactory_password_2}&quot; 
              
          }
          defaults {
              publishBuildInfo = false
              publications('mavenJava')
          }
      }
  
  }
  
  
  subprojects {
          // copy libs to root build/libs
          apply from: &quot;${rootProject.projectDir}/gradle/utils/java/copy-libs-to-root.gradle&quot;
          apply plugin: &quot;com.jfrog.artifactory&quot;
          apply plugin: 'java'
          apply plugin: 'base'
          apply plugin: 'maven-publish'
          apply plugin: 'eclipse'
          ext.componentName = &quot;${project.name}&quot;
          eclipse.project.name = ext.componentName
          version = '0.0.1'
  
          repositories {
                  mavenLocal()
          }
  
          jar {
                  manifest {
                          attributes  'Specification-Title': &quot;${baseName}&quot;,
                                      'Specification-Version': version,
                                      'Implementation-Title': &quot;${baseName}&quot;,
                                      'Implementation-Version': version,
                                      'Bundle-Version': version
                  }
          }
  
  }
  
  
  project(':common-utils:opensearch-sdk') {
      ext.componentDescription = 'common-utils'
      apply plugin: 'java'
      apply plugin: 'eclipse'
      publishing {
          publications {
                mavenJava(MavenPublication) {
                      groupId = &quot;com.example.app&quot;
                    from components.java
                }
           }
      }
  }
  
  </code></pre>
  <p>When I try to deploy artifacts using</p>
  <pre><code> ./gradlew :common-utils:opensearch-sdk:build :common-utils:opensearch-sdk:artifactoryPublish
  </code></pre>
  <p>opensearch-sdk-1.0.jar is getting deployed only to artifactory_contextUrl_2.</p>
  <p>Looks like artifactory_contextUrl_1 configuration is getting overwritten by artifactory_contextUrl_2.</p>