From bc80d25b490a540c36ce4265d1ebaad11b679138 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Fri, 25 Jan 2013 16:38:30 -0800 Subject: [PATCH] Restore compile dependencies in generated POMs Ensure that merge projects do not downgrade the compile time dependencies of the projects that they are merged into. This commit restores the scope of the following dependencies which were inadvertently changed between Spring 3.2.0 and 3.2.1: spring-orm -> spring-tx -> spring-jdbc spring-webmvc -> spring-context -> spring-web spring-test -> spring-webmvc Issue: SPR-10218 --- build.gradle | 2 +- .../org/springframework/build/gradle/MergePlugin.groovy | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 19fe164e4d..9ac71e790a 100644 --- a/build.gradle +++ b/build.gradle @@ -689,7 +689,7 @@ project("spring-test-mvc") { description = "Spring Test MVC Framework" merge.into = project(":spring-test") dependencies { - provided(project(":spring-context")) + optional(project(":spring-context")) provided(project(":spring-webmvc")) provided("javax.servlet:javax.servlet-api:3.0.1") optional("org.hamcrest:hamcrest-core:1.3") diff --git a/buildSrc/src/main/groovy/org/springframework/build/gradle/MergePlugin.groovy b/buildSrc/src/main/groovy/org/springframework/build/gradle/MergePlugin.groovy index 097e65ab93..510a2698c6 100644 --- a/buildSrc/src/main/groovy/org/springframework/build/gradle/MergePlugin.groovy +++ b/buildSrc/src/main/groovy/org/springframework/build/gradle/MergePlugin.groovy @@ -128,7 +128,13 @@ class MergePlugin implements Plugin { (ExcludeRule.GROUP_KEY) : it.group, (ExcludeRule.MODULE_KEY) : it.module]) } - intoConfiguration.dependencies.addAll(configuration.dependencies) + configuration.dependencies.each { + def intoCompile = project.merge.into.configurations.getByName("compile") + // Protect against changing a compile scope dependency (SPR-10218) + if(!intoCompile.dependencies.contains(it)) { + intoConfiguration.dependencies.add(it) + } + } project.merge.into.install.repositories.mavenInstaller.pom.scopeMappings.addMapping( mapping.priority + 100, intoConfiguration, mapping.scope) }