From f8b2ad552f9ba70c429183135db928c3a5680fa9 Mon Sep 17 00:00:00 2001 From: Brian Clozel Date: Wed, 2 Jun 2021 15:45:51 +0200 Subject: [PATCH] Refactor project build This commit refactors the project build to better share dependency management definitions between modules. This also upgrades the project to Spring Boot 2.5.0. Closes gh-45 --- build.gradle | 54 ++++++++++++++++++++++-- graphql-spring-boot-starter/build.gradle | 6 +-- samples/webflux-websocket/build.gradle | 3 +- samples/webmvc-http/build.gradle | 3 +- spring-graphql-test/build.gradle | 35 +++------------ spring-graphql/build.gradle | 35 +++------------ 6 files changed, 66 insertions(+), 70 deletions(-) diff --git a/build.gradle b/build.gradle index 3fd6426f..e99d1a48 100644 --- a/build.gradle +++ b/build.gradle @@ -1,10 +1,58 @@ +plugins { + id 'io.spring.dependency-management' version '1.0.11.RELEASE' +} + +ext { + moduleProjects = subprojects.findAll { it.name.startsWith("spring-") } +} + subprojects { - group = 'org.springframework.experimental' + apply plugin: 'io.spring.dependency-management' + + group = 'org.springframework.graphql' version = "1.0.0-SNAPSHOT" repositories { mavenCentral() - maven { url 'https://repo.spring.io/milestone' } - maven { url 'https://repo.spring.io/snapshot' } + if (version.contains('-')) { + maven { url "https://repo.spring.io/milestone" } + } + if (version.endsWith('-SNAPSHOT')) { + maven { url "https://repo.spring.io/snapshot" } + } } } + +configure(moduleProjects) { + apply plugin: 'java-library' + apply plugin: 'org.springframework.graphql.conventions' + + java { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + + dependencyManagement { + imports { + mavenBom "com.fasterxml.jackson:jackson-bom:2.12.3" + mavenBom "io.projectreactor:reactor-bom:2020.0.7" + mavenBom "org.springframework:spring-framework-bom:5.3.7" + mavenBom "org.junit:junit-bom:5.7.2" + } + dependencies { + dependency 'com.graphql-java:graphql-java:16.2' + dependency 'org.assertj:assertj-core:3.19.0' + dependencySet(group: 'org.apache.logging.log4j', version: '2.14.1') { + entry 'log4j-api' + entry 'log4j-core' + entry 'log4j-jul' + entry 'log4j-slf4j-impl' + } + } + generatedPomCustomization { + enabled = false + } + } + + apply from: "${rootDir}/gradle/publishing.gradle" +} diff --git a/graphql-spring-boot-starter/build.gradle b/graphql-spring-boot-starter/build.gradle index 73b62d05..92682556 100644 --- a/graphql-spring-boot-starter/build.gradle +++ b/graphql-spring-boot-starter/build.gradle @@ -1,12 +1,12 @@ import org.springframework.boot.gradle.plugin.SpringBootPlugin plugins { - id 'org.springframework.boot' version '2.4.5' apply false - id 'io.spring.dependency-management' version '1.0.10.RELEASE' + id 'org.springframework.boot' version '2.5.0' apply false id 'java-library' - id "org.springframework.graphql.conventions" + id 'org.springframework.graphql.conventions' } +group = 'org.springframework.experimental' description = "GraphQL Spring Boot Starter" java { diff --git a/samples/webflux-websocket/build.gradle b/samples/webflux-websocket/build.gradle index 8589f367..40b15397 100644 --- a/samples/webflux-websocket/build.gradle +++ b/samples/webflux-websocket/build.gradle @@ -1,6 +1,5 @@ plugins { - id 'org.springframework.boot' version '2.4.5' - id 'io.spring.dependency-management' version '1.0.10.RELEASE' + id 'org.springframework.boot' version '2.5.0' id 'java' } group = 'com.example' diff --git a/samples/webmvc-http/build.gradle b/samples/webmvc-http/build.gradle index 37bd2a90..299812d6 100644 --- a/samples/webmvc-http/build.gradle +++ b/samples/webmvc-http/build.gradle @@ -1,6 +1,5 @@ plugins { - id 'org.springframework.boot' version '2.4.5' - id 'io.spring.dependency-management' version '1.0.10.RELEASE' + id 'org.springframework.boot' version '2.5.0' id 'java' } group = 'com.example' diff --git a/spring-graphql-test/build.gradle b/spring-graphql-test/build.gradle index cf22ea3a..2fe38316 100644 --- a/spring-graphql-test/build.gradle +++ b/spring-graphql-test/build.gradle @@ -1,31 +1,8 @@ - -plugins { - id 'io.spring.dependency-management' version '1.0.10.RELEASE' - id 'java-library' - id "org.springframework.graphql.conventions" -} - description = "Spring Support for Testing GraphQL Applications" -java { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 -} - -dependencyManagement { - imports { - mavenBom "com.fasterxml.jackson:jackson-bom:2.12.3" - mavenBom "io.projectreactor:reactor-bom:2020.0.6" - mavenBom "org.springframework:spring-framework-bom:5.3.6" - } - generatedPomCustomization { - enabled = false - } -} - dependencies { api project(':spring-graphql') - api 'com.graphql-java:graphql-java:16.2' + api 'com.graphql-java:graphql-java' api 'io.projectreactor:reactor-core' api 'org.springframework:spring-context' api 'org.springframework:spring-test' @@ -38,8 +15,8 @@ dependencies { compileOnly 'javax.servlet:javax.servlet-api:4.0.1' compileOnly 'org.skyscreamer:jsonassert:1.5.0' - testImplementation 'org.junit.jupiter:junit-jupiter:5.7.1' - testImplementation 'org.assertj:assertj-core:3.19.0' + testImplementation 'org.junit.jupiter:junit-jupiter' + testImplementation 'org.assertj:assertj-core' testImplementation 'org.mockito:mockito-core:3.8.0' testImplementation 'org.skyscreamer:jsonassert:1.5.0' testImplementation 'org.springframework:spring-webflux' @@ -49,8 +26,8 @@ dependencies { testImplementation 'com.squareup.okhttp3:mockwebserver:3.14.9' testImplementation 'com.fasterxml.jackson.core:jackson-databind' - testRuntimeOnly 'org.apache.logging.log4j:log4j-core:2.14.1' - testRuntimeOnly 'org.apache.logging.log4j:log4j-slf4j-impl:2.14.1' + testRuntimeOnly 'org.apache.logging.log4j:log4j-core' + testRuntimeOnly 'org.apache.logging.log4j:log4j-slf4j-impl' } test { @@ -59,5 +36,3 @@ test { events "passed", "skipped", "failed" } } - -apply from: "${rootDir}/gradle/publishing.gradle" diff --git a/spring-graphql/build.gradle b/spring-graphql/build.gradle index 03f31220..eac17b21 100644 --- a/spring-graphql/build.gradle +++ b/spring-graphql/build.gradle @@ -1,30 +1,7 @@ - -plugins { - id 'io.spring.dependency-management' version '1.0.10.RELEASE' - id 'java-library' - id "org.springframework.graphql.conventions" -} - description = "GraphQL Support for Spring Applications" -java { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 -} - -dependencyManagement { - imports { - mavenBom "com.fasterxml.jackson:jackson-bom:2.12.3" - mavenBom "io.projectreactor:reactor-bom:2020.0.6" - mavenBom "org.springframework:spring-framework-bom:5.3.6" - } - generatedPomCustomization { - enabled = false - } -} - dependencies { - api 'com.graphql-java:graphql-java:16.2' + api 'com.graphql-java:graphql-java' api 'io.projectreactor:reactor-core' api 'org.springframework:spring-context' @@ -34,8 +11,8 @@ dependencies { compileOnly 'org.springframework:spring-websocket' compileOnly 'javax.servlet:javax.servlet-api:4.0.1' - testImplementation 'org.junit.jupiter:junit-jupiter:5.7.1' - testImplementation 'org.assertj:assertj-core:3.19.0' + testImplementation 'org.junit.jupiter:junit-jupiter' + testImplementation 'org.assertj:assertj-core' testImplementation 'io.projectreactor:reactor-test' testImplementation 'org.springframework:spring-webflux' testImplementation 'org.springframework:spring-webmvc' @@ -44,8 +21,8 @@ dependencies { testImplementation 'javax.servlet:javax.servlet-api:4.0.1' testImplementation 'com.fasterxml.jackson.core:jackson-databind' - testRuntimeOnly 'org.apache.logging.log4j:log4j-core:2.14.1' - testRuntimeOnly 'org.apache.logging.log4j:log4j-slf4j-impl:2.14.1' + testRuntimeOnly 'org.apache.logging.log4j:log4j-core' + testRuntimeOnly 'org.apache.logging.log4j:log4j-slf4j-impl' } test { @@ -54,5 +31,3 @@ test { events "passed", "skipped", "failed" } } - -apply from: "${rootDir}/gradle/publishing.gradle"