Upload two different artifacts to two different nexus repositories from the same project


(Nikolay Nachev) #1

Hello everyone! As the topic says already I am trying to upload two different artifacts to two different nexus repositories from the same gradle project. Every artifact is assigned to a different configuration, therefore there are two different upload tasks. The Problem is that only the first artifact is uploaded. Which is the first artifact depends on the execution order of the both tasks. When the two tasks are executed separately, then everything works as expected.

// plugin file 1
project.tasks.create('createReleaseZip', Zip) {
          // create release zip file
}
project.artifacts { archives createReleaseZip }
project.tasks.uploadArchives {
  repositories {
    mavenDeployer {
      repository(url: nexus_release_url) {
        authentication(userName: ..., password: ...)
      }
    }
  }
}

// plugin file 2
project.configurations.create('propertiesArchive')
project.tasks.create('createPropertiesZip', Zip) {
  // create properties zip file
}
project.artifacts { propertiesArchive createPropertiesZip }
project.tasks.uploadPropertiesArchives {
  repositories {
    mavenDeployer {
      repository(url: nexus_properties_url) 
      pom {
        artifactId = "...different from the release artifact..."
      }
    }
  }
}

Both tasks are created in two different plugin files under the buildSrc folder