Skip to content
This repository has been archived by the owner on May 11, 2021. It is now read-only.

Commit

Permalink
[#70] More comprehensive dependency management - PoC
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcin Zajaczkowski committed Nov 27, 2014
1 parent 3d9c450 commit fa147f1
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 32 deletions.
40 changes: 31 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +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.4'
classpath "io.spring.gradle:dependency-management-plugin:0.2.1.RELEASE"
if (project.hasProperty("coverage")) { classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:+' }
}
}
Expand All @@ -31,15 +32,6 @@ allprojects {
}
}

ext {
microDepsSpringConfigVersion = '0.5.0'
groovyVersion = '2.3.7'
spockVersion = '0.7-groovy-2.0'
springBootVersion = '1.1.8.RELEASE'
springTestVersion = '4.1.1.RELEASE'
logbackVersion = '1.1.2'
}

task addHashFile << {
String gitCmd = "git log --pretty=format:'%H' -n 1"
def proc = gitCmd.execute()
Expand All @@ -54,9 +46,28 @@ configure(srcSubprojects) {
apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'com.ofg.uptodate'
apply plugin: "io.spring.dependency-management"

sourceCompatibility = 1.7

dependencyManagement {
dependencies {
dependencySet(group: "com.ofg", version: "0.5.0") {
entry "micro-deps-spring-config"
entry "micro-deps-spring-test-config"
}
"org.codehaus.groovy:groovy-all" "2.3.7"
"org.springframework.boot:spring-boot-starter-web" "1.1.8.RELEASE"
"ch.qos.logback:logback-classic" "1.1.2"

dependencySet(group:'org.spockframework', version: '0.7-groovy-2.0') {
entry "spock-core"
entry "spock-spring"
}
"org.springframework:spring-test" "4.1.1.RELEASE"
}
}

//Workaround for the issue with Java 8u11 and 7u65 - http://www.infoq.com/news/2014/08/Java8-U11-Broke-Tools
test {
jvmArgs '-noverify'
Expand Down Expand Up @@ -96,6 +107,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)
}
}
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions micro-infra-camel/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ ext {

dependencies {
compile project(':micro-infra-spring-base')
compile "org.codehaus.groovy:groovy-all:$groovyVersion"
compile "org.codehaus.groovy:groovy-all"
compile("org.apache.camel:camel-spring-javaconfig:$camelVersion") {
exclude group: 'org.springframework', module: 'spring-test'
}
testCompile "org.spockframework:spock-core:$spockVersion"
testRuntime "org.spockframework:spock-spring:$spockVersion"
testCompile "org.spockframework:spock-core"
testRuntime "org.spockframework:spock-spring"
testCompile "org.apache.camel:camel-test-spring:$camelVersion"
testCompile "org.springframework:spring-test:$springTestVersion"
testCompile "org.springframework:spring-test"
}
8 changes: 4 additions & 4 deletions micro-infra-hystrix/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ description = 'Wrapper around HystrixCommand that propagates correlation ID'

dependencies {
compile project(':micro-infra-spring-base')
compile "org.codehaus.groovy:groovy-all:$groovyVersion"
compile "org.codehaus.groovy:groovy-all"
compile 'com.netflix.hystrix:hystrix-core:1.4.0-RC5'

testCompile "org.spockframework:spock-core:$spockVersion"
testRuntime "org.spockframework:spock-spring:$spockVersion"
testCompile "org.springframework:spring-test:$springTestVersion"
testCompile "org.spockframework:spock-core"
testRuntime "org.spockframework:spock-spring"
testCompile "org.springframework:spring-test"
}
12 changes: 6 additions & 6 deletions micro-infra-spring-base/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ sourceSets.main.java.srcDirs = []
sourceSets.main.groovy.srcDirs += ["src/main/java", "src/main/groovy"]

dependencies {
compile("com.ofg:micro-deps-spring-config:$microDepsSpringConfigVersion") {
compile("com.ofg:micro-deps-spring-config") {
//Required with micro-deps 0.4.0 as it uses groovy-all-indy which confuses Intellij Idea (both jars are added to dependencies)
exclude group: 'org.codehaus.groovy', module: 'groovy-all'
}
compile "org.codehaus.groovy:groovy-all:$groovyVersion"
compile "org.codehaus.groovy:groovy-all"
compile 'com.fasterxml.jackson.core:jackson-databind:2.4.3'
compile "org.springframework.boot:spring-boot-starter-web:$springBootVersion"
compile "org.springframework.boot:spring-boot-starter-web"
compile "org.codehaus.jackson:jackson-mapper-asl:$jacksonMapper"
compile "org.codehaus.jackson:jackson-core-asl:$jacksonMapper"
compile "org.aspectj:aspectjrt:$aspectjVersion"
Expand All @@ -25,9 +25,9 @@ dependencies {

runtime "org.aspectj:aspectjweaver:$aspectjVersion"

testCompile "org.spockframework:spock-core:$spockVersion"
testRuntime "org.spockframework:spock-spring:$spockVersion"
testCompile "org.springframework:spring-test:$springTestVersion"
testCompile "org.spockframework:spock-core"
testRuntime "org.spockframework:spock-spring"
testCompile "org.springframework:spring-test"
testCompile 'org.hamcrest:hamcrest-library:1.3'
testCompile 'org.hibernate:hibernate-validator:5.1.3.Final'
testCompile 'com.jayway.jsonpath:json-path-assert:0.9.1'
Expand Down
6 changes: 3 additions & 3 deletions micro-infra-spring-config/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ dependencies {
}
compile "org.springframework.security:spring-security-rsa:$springSecurityRsaVersion"
compile "org.eclipse.jgit:org.eclipse.jgit:2.3.1.201302201838-r"
compile "org.codehaus.groovy:groovy-all:$groovyVersion"
compile "org.codehaus.groovy:groovy-all"
compile "org.aspectj:aspectjrt:1.8.3"

testCompile "org.spockframework:spock-core:$spock10Version"
testRuntime "org.springframework:spring-test:$springTestVersion"
testRuntime "org.springframework:spring-test"
testRuntime "org.spockframework:spock-spring:$spock10Version"
testRuntime "ch.qos.logback:logback-classic:$logbackVersion"
testRuntime "ch.qos.logback:logback-classic"
testCompile 'com.jayway.awaitility:awaitility:1.6.2'
}

Expand Down
6 changes: 3 additions & 3 deletions micro-infra-spring-reactor/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ dependencies {
compile "org.projectreactor:reactor-core:1.1.5.RELEASE"
compile "org.projectreactor:reactor-spring:1.0.1.RELEASE"

testCompile("org.spockframework:spock-core:$spockVersion") {
testCompile("org.spockframework:spock-core") {
exclude group: 'org.codehaus.groovy', module: 'groovy-all'
}
testRuntime("org.spockframework:spock-spring:$spockVersion") {
testRuntime("org.spockframework:spock-spring") {
exclude group: 'org.spockframework', module: 'spock-core'
}
testCompile "org.springframework:spring-test:$springTestVersion"
testCompile "org.springframework:spring-test"
testCompile 'com.jayway.awaitility:awaitility:1.6.2'
}
2 changes: 1 addition & 1 deletion micro-infra-spring-test/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
description = 'Microservice testing utilities'

dependencies {
compile("com.ofg:micro-deps-spring-test-config:$microDepsSpringConfigVersion") {
compile("com.ofg:micro-deps-spring-test-config") {
//Required with micro-deps 0.4.0 as it uses groovy-all-indy which confuses Intellij Idea (both jars are added to dependencies)
exclude group: 'org.codehaus.groovy', module: 'groovy-all'
}
Expand Down
4 changes: 2 additions & 2 deletions swagger/micro-infra-spring-swagger/build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
description = 'Microservice Spring Swagger configuration'

dependencies {
compile "org.codehaus.groovy:groovy-all:$groovyVersion"
compile "org.codehaus.groovy:groovy-all"
compile("com.mangofactory:swagger-springmvc:0.9.0") {
exclude group: 'org.mockito'
exclude module: 'scala-compiler'
}
compile "org.springframework.boot:spring-boot-starter-web:$springBootVersion"
compile "org.springframework.boot:spring-boot-starter-web"
}

4 comments on commit fa147f1

@nurkiewicz
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently this commit breaks gradle install, can you have a look?

git bisect start
git bisect good ee21c8f
git bisect bad master
git bisect run gw clean install -x test
...

fa147f1ed0f87df1c22587cca356b2de6f6c2cb0 is the first bad commit
commit fa147f1ed0f87df1c22587cca356b2de6f6c2cb0
Author: Marcin Zajaczkowski <marcin.zajaczkowski@4finance.com>
Date:   Thu Nov 27 17:50:37 2014 +0100

    [#70] More comprehensive dependency management - PoC

    With: https://github.com/spring-gradle-plugins/dependency-management-plugin

@nurkiewicz
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gradle publishToMavenLocal

Seems to be a valid workaround.

@szpak
Copy link
Collaborator

@szpak szpak commented on fa147f1 Dec 8, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reported it as #19, but probably it would need a hack to work. publishToMavenLocal could be used to do the same. I will remove old maven plugin which probably isn't used for anything else nowadays.

@szpak
Copy link
Collaborator

@szpak szpak commented on fa147f1 Dec 8, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I missed your comment @nurkiewicz :).

Please sign in to comment.