In a multi-project build, how can I specify a different repository to publish to for each subproject?
This is what I’m trying to do:
I have a multi-project build with 2 projects: projectA and projectB.
My settings file looks like this:
include 'projectA', 'projectB'
In the build.gradle file of my rootproject I’ve specified that the artifactory-publish plugin must be applied to all projects:
allprojects {
apply plugin: 'maven-publish'
apply plugin: 'artifactory-publish'
}
In each subproject I have an artifactory closure to configure where the deliverables of each project should be published. ProjectA and projectB have to publish to different repositories. I try to do this by setting a different value for artifactory.publish.repository.repoKey for each.
artifactory {
publish {
contextUrl = "${project['artifactory.url']}"
repository {
repoKey = repositoryForProjectA
// or repositoryForProjectB
username = project['artifactory.username']
password = project['artifactory.password']
maven = true
}
defaults {
publications (project.name)
}
}
}
When I run “gradle build artifactoryPublish” everything gets build and published, but all deliverables and up in the same repository, the one that was specified by projectB.
Kind regards,
Glenn