Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

uploadArchives with mavenDeployer to multiple repos

Tags:

gradle

I have a gradle project that acts like a common library for two other projects.

The other two projects each hosts an embedded maven repository that I want the common project to deploy to.

I've tried this:

uploadArchives {
    repositories {
        mavenDeployer {
            repositories {
                repository(url: '../../../project-web-service/repo')
                repository(url: '../../../project-app/repo')
            }
        }
    }
}

But this only deploys to the second repo.

I have read Configuring multiple upload repositories in Gradle build, but it doesn't cover the mavenDeployer, so I'm kind of stuck right now.

like image 658
Gustav Karlsson Avatar asked Apr 20 '14 12:04

Gustav Karlsson


2 Answers

You can create two your own tasks (extends from Upload), just like this:

task uploadFirst(type: Upload) {
  uploadDescriptor = true
  repositories {
    mavenDeployer {
      repositories {
        repository(url: '../../../project-web-service/repo')
      }
    }
  }
}

task uploadSecond(type: Upload) {
  uploadDescriptor = true
  repositories {
    mavenDeployer {
      repositories {
        repository(url: '../../../project-app/repo')
      }
    }
  }
}
like image 160
iMysak Avatar answered Nov 17 '22 14:11

iMysak


I had the same issue and was just able to solve it by giving the additional repositories names, but still leaving their own mavenDeployer closure.

For your example:

uploadArchives {
    repositories {
        mavenDeployer {
            name = 'WebService'
            repository(url: '../../../project-web-service/repo')
        }
        mavenDeployer {
            name = 'App'
            repository(url: '../../../project-app/repo')
        }
    }
}
like image 1
John Leehey Avatar answered Nov 17 '22 15:11

John Leehey