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 44d270adb4..9c9e2f6be2 100644 --- a/buildSrc/src/main/groovy/org/springframework/build/gradle/MergePlugin.groovy +++ b/buildSrc/src/main/groovy/org/springframework/build/gradle/MergePlugin.groovy @@ -64,6 +64,7 @@ class MergePlugin implements Plugin { project.plugins.apply(IdeaPlugin) MergeModel model = project.extensions.create("merge", MergeModel) + model.project = project project.configurations.create("merging") Configuration runtimeMerge = project.configurations.create("runtimeMerge") @@ -76,6 +77,7 @@ class MergePlugin implements Plugin { if (it.merge.into != null) { setup(it) } + setupIdeDependencies(it) } // Hook to build runtimeMerge dependencies @@ -114,6 +116,16 @@ class MergePlugin implements Plugin { } } + private void setupIdeDependencies(Project project) { + project.configurations.each { c -> + c.dependencies.findAll( { it instanceof org.gradle.api.artifacts.ProjectDependency } ).each { d -> + d.dependencyProject.merge.from.each { from -> + project.dependencies.add("runtimeMerge", from) + } + } + } + } + private void setupMaven(Project project) { project.configurations.each { configuration -> Conf2ScopeMapping mapping = project.conf2ScopeMappings.getMapping([configuration]) @@ -154,5 +166,12 @@ class MergePlugin implements Plugin { } class MergeModel { + Project project; Project into; + List from = []; + + public void setInto(Project into) { + this.into = into; + into.merge.from.add(project); + } }