From 8a6d251a3a30df2e0d9b75ae7781687f35fe283b Mon Sep 17 00:00:00 2001 From: Marcin Zajaczkowski Date: Thu, 18 Dec 2014 23:40:56 +0100 Subject: [PATCH] Revert "[#70] Remove hack with putting dependencies versions in pom.xml" There is a bug in dependency-management-plugin 0.3.0 which fails the build: https://github.com/spring-gradle-plugins/dependency-management-plugin/issues/21 This reverts commit 14c4ab3197659b5ff77ad89209ff3c2dd0e71e67. --- build.gradle | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index d6942a0e..f63d15b4 100644 --- a/build.gradle +++ b/build.gradle @@ -8,7 +8,7 @@ buildscript { classpath 'com.ofg:uptodate-gradle-plugin:+' classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:+' classpath 'pl.allegro.tech.build:axion-release-plugin:0.9.9' - classpath "io.spring.gradle:dependency-management-plugin:0.3.0.RELEASE" + classpath "io.spring.gradle:dependency-management-plugin:0.2.1.RELEASE" if (project.hasProperty("coverage")) { classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:+' } if (project.hasProperty("compatibility")) { classpath "be.insaneprogramming.gradle:animalsniffer-gradle-plugin:+" } } @@ -53,6 +53,7 @@ task addHashFile << { def srcSubprojects = subprojects - project(':swagger') configure(srcSubprojects) { apply plugin: 'groovy' + apply plugin: 'maven' apply plugin: 'maven-publish' apply plugin: 'com.jfrog.bintray' apply plugin: 'com.ofg.uptodate' @@ -129,6 +130,17 @@ configure(srcSubprojects) { }.each() { it.scope*.value = 'compile' } + //#70 - workaround for empty version in pom.xml when dependency-management-plugin is used + //Known limitation of new Gradle publishing mechanism - https://github.com/spring-gradle-plugins/dependency-management-plugin/issues/8 + asNode().dependencies[0]?.get('dependency')?.each() { dep -> + String pomVer = dep.get("version").text(); + String pomArtifactId = dep.get("artifactId").text(); + String pomGroupId = dep.get("groupId").text(); + if (pomVer.isEmpty()) { + def depVer = project.dependencyManagement.getManagedVersion("$pomGroupId", "$pomArtifactId") + dep.appendNode('version', depVer) + } + } } } }