From 39d419bbc37b6b85741dce6c3ed6fb96bf39d804 Mon Sep 17 00:00:00 2001 From: Rob Winch Date: Wed, 21 Nov 2012 10:59:29 -0600 Subject: [PATCH] Support Gradle/maven with multi version artifacts Previously the publish-maven.gradle only supported having a single artifact be marked as optional or provided. This causes problems now that we are building modules that support multiple versions of an artifact. For example, we compile against two versions of Tiles artifacts with identical names, both of which need to be marked optional. This updates publish-maven.gradle to find all the artifacts and mark them as optional as apposed to the first entry. --- publish-maven.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/publish-maven.gradle b/publish-maven.gradle index 0b7c68d198..b7d01cbf83 100644 --- a/publish-maven.gradle +++ b/publish-maven.gradle @@ -16,10 +16,10 @@ def customizePom(pom, gradleProject) { pom.whenConfigured { generatedPom -> // respect 'optional' and 'provided' dependencies gradleProject.optionalDeps.each { dep -> - generatedPom.dependencies.find { it.artifactId == dep.name }?.optional = true + generatedPom.dependencies.findAll { it.artifactId == dep.name }*.optional = true } gradleProject.providedDeps.each { dep -> - generatedPom.dependencies.find { it.artifactId == dep.name }?.scope = 'provided' + generatedPom.dependencies.findAll { it.artifactId == dep.name }*.scope = 'provided' } // eliminate test-scoped dependencies (no need in maven central poms)