Use Gradle-native BOM support for dependency management

This commit is contained in:
Gareth Clay
2022-11-28 15:47:24 +00:00
committed by Scott Frederick
parent 06616b0ec8
commit 916832f01a
11 changed files with 79 additions and 168 deletions

View File

@@ -19,7 +19,7 @@ To build the source you will need to install JDK 17.
Spring CredHub uses Gradle for most build-related activities, and you should be able to get off the ground quite quickly by cloning the project you are interested in and typing
----
$ ./gradlew install
$ ./gradlew build
----
=== Working with the code
@@ -27,5 +27,3 @@ $ ./gradlew install
If you don't have an IDE preference we would recommend that you use
https://www.springsource.com/developer/sts[Spring Tools Suite] or
https://eclipse.org[Eclipse] when working with the code.

View File

@@ -16,9 +16,8 @@
plugins {
id 'checkstyle'
id 'io.spring.nohttp' version '0.0.10'
id 'io.spring.dependency-management' version '1.0.15.RELEASE'
id 'io.spring.javaformat' version '0.0.35'
id 'io.spring.nohttp'
id 'io.spring.javaformat'
}
description = "Spring CredHub"
@@ -27,18 +26,8 @@ ext {
springVersion = "6.0.0"
springBootVersion = "3.0.0-RC2"
springSecurityVersion = "6.0.0-RC2"
reactorVersion = "2020.0.24"
okHttp3Version = "4.9.3"
httpClient5Version = "5.1.3"
nettyVersion = "4.1.84.Final"
junitVersion = "5.7.2"
mockitoVersion = "3.9.0"
assertJVersion = "3.19.0"
javadocLinks = [
"https://docs.oracle.com/javase/8/docs/api/",
"https://docs.oracle.com/javase/17/docs/api/",
'https://docs.spring.io/spring/docs/current/javadoc-api/',
] as String[]
}
@@ -47,24 +36,7 @@ configure(allprojects) {
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: "io.spring.dependency-management"
group = 'org.springframework.credhub'
repositories {
mavenCentral()
maven { url 'https://repo.spring.io/release' }
}
if (version =~ /((-M|-RC)[0-9]+|-SNAPSHOT)$/) {
repositories {
maven { url 'https://repo.spring.io/milestone' }
}
}
if (version.endsWith('-SNAPSHOT')) {
repositories {
maven { url 'https://repo.spring.io/snapshot' }
}
}
}
configure(allprojects) {
@@ -119,14 +91,14 @@ configure(publishedProjects) {
}
subprojects {
sourceCompatibility = 17
targetCompatibility = 17
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
registerFeature('reactive') {
usingSourceSet(sourceSets.main)
}

View File

@@ -1,12 +1,10 @@
version: '2'
services:
uaa:
image: pcfseceng/uaa
volumes:
- ./uaa.yml:/uaa/uaa.yml
ports:
- 8080:8080
- "8080:8080"
restart: always
credhub:
@@ -19,4 +17,4 @@ services:
- uaa
environment:
UAA_URL: http://localhost:8080/uaa
UAA_INTERNAL_URL: http://uaa:8080/uaa
UAA_INTERNAL_URL: http://uaa:8080/uaa

View File

@@ -59,6 +59,11 @@ publishing {
email = "sfrederick@pivotal.io"
}
}
withXml {
def pomNode = asNode()
def dependencyManagementNode = pomNode.get('dependencyManagement')
if (dependencyManagementNode) pomNode.remove(dependencyManagementNode)
}
}
// Published pom will use fully-qualified dependency versions and no BOMs
@@ -70,11 +75,6 @@ publishing {
fromResolutionResult()
}
}
pom.withXml {
def dependencyManagementNode = asNode().get("dependencyManagement")
asNode().remove(dependencyManagementNode)
}
}
}
}

View File

@@ -15,19 +15,34 @@
*/
pluginManagement {
plugins {
id 'io.spring.nohttp' version '0.0.10'
id 'io.spring.javaformat' version '0.0.35'
id 'org.asciidoctor.jvm.convert' version '3.3.2'
id 'org.springframework.boot' version '3.0.0'
}
repositories {
gradlePluginPortal()
mavenCentral()
maven { url "https://repo.spring.io/plugins-release" }
if (version.endsWith('-SNAPSHOT')) {
maven { url "https://repo.spring.io/plugins-snapshot" }
}
}
resolutionStrategy {
eachPlugin {
if (requested.id.id == "io.spring.javaformat") {
useModule "io.spring.javaformat:spring-javaformat-gradle-plugin:${requested.version}"
}
}
dependencyResolutionManagement {
repositories {
mavenCentral()
maven { url 'https://repo.spring.io/release' }
}
if (version =~ /((-M|-RC)[0-9]+|-SNAPSHOT)$/) {
repositories {
maven { url 'https://repo.spring.io/milestone' }
}
}
if (version.endsWith('-SNAPSHOT')) {
repositories {
maven { url 'https://repo.spring.io/snapshot' }
}
}
}
@@ -39,9 +54,3 @@ include ':spring-credhub-starter'
include ':spring-credhub-integration-tests'
include ':spring-credhub-reactive-integration-tests'
include ':spring-credhub-docs'
project(':spring-credhub-core').projectDir = "$rootDir/spring-credhub-core" as File
project(':spring-credhub-starter').projectDir = "$rootDir/spring-credhub-starter" as File
project(':spring-credhub-integration-tests').projectDir = "$rootDir/spring-credhub-integration-tests" as File
project(':spring-credhub-reactive-integration-tests').projectDir = "$rootDir/spring-credhub-reactive-integration-tests" as File
project(':spring-credhub-docs').projectDir = "$rootDir/spring-credhub-docs" as File

View File

@@ -14,43 +14,36 @@
* limitations under the License.
*/
dependencyManagement {
imports {
mavenBom "org.springframework:spring-framework-bom:${springVersion}"
mavenBom "org.springframework.security:spring-security-bom:${springSecurityVersion}"
mavenBom "io.projectreactor:reactor-bom:${reactorVersion}"
}
}
description = 'Spring CredHub Core'
dependencies {
api(platform("org.springframework.boot:spring-boot-dependencies:${springBootVersion}"))
api("org.springframework:spring-core")
api("org.springframework:spring-beans")
api("org.springframework:spring-context")
api("org.springframework:spring-web")
api("com.fasterxml.jackson.core:jackson-databind:2.13.3")
api("com.fasterxml.jackson.core:jackson-databind")
api("org.springframework.security:spring-security-oauth2-client") {
exclude module: "spring-security-web"
}
reactiveImplementation("org.springframework:spring-webflux")
reactiveImplementation("io.projectreactor.netty:reactor-netty")
api("org.springframework.security:spring-security-oauth2-client") {
exclude module: "spring-security-web"
}
securityImplementation("org.springframework.security:spring-security-config")
httpclientImplementation("org.apache.httpcomponents.client5:httpclient5:${httpClient5Version}") {
httpclientImplementation("org.apache.httpcomponents.client5:httpclient5") {
exclude(group: 'commons-logging', module: 'commons-logging')
}
okhttpImplementation("com.squareup.okhttp3:okhttp:${okHttp3Version}")
okhttpImplementation("com.squareup.okhttp3:okhttp")
testImplementation("org.springframework:spring-test")
testImplementation("io.projectreactor:reactor-test")
testImplementation("org.junit.jupiter:junit-jupiter-api:${junitVersion}")
testImplementation("org.junit.jupiter:junit-jupiter-params:${junitVersion}")
testImplementation("org.mockito:mockito-core:${mockitoVersion}")
testImplementation("org.mockito:mockito-junit-jupiter:${mockitoVersion}")
testImplementation("org.assertj:assertj-core:${assertJVersion}")
testImplementation("com.jayway.jsonpath:json-path:2.4.0")
testImplementation("org.junit.jupiter:junit-jupiter-api")
testImplementation("org.junit.jupiter:junit-jupiter-params")
testImplementation("org.mockito:mockito-core")
testImplementation("org.mockito:mockito-junit-jupiter")
testImplementation("org.assertj:assertj-core")
testImplementation("com.jayway.jsonpath:json-path")
}

View File

@@ -14,40 +14,16 @@
* limitations under the License.
*/
plugins {
id 'org.springframework.boot' version '3.0.0'
id 'eclipse'
}
description = 'Spring CredHub Demo'
buildscript {
ext {
springBootVersion = "3.0.0-RC2"
}
dependencies {
classpath('io.spring.gradle:dependency-management-plugin:1.0.11.RELEASE')
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
repositories {
mavenCentral()
maven { url "https://repo.spring.io/plugins-release" }
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'org.springframework.boot'
dependencies {
compile("org.springframework.boot:spring-boot-starter-web")
compile("org.springframework.boot:spring-boot-starter-actuator")
compile("org.springframework.boot:spring-boot-starter-security")
compile("org.springframework.credhub:spring-credhub-starter:2.2.0-SNAPSHOT")
}
repositories {
mavenCentral()
maven { url "https://repo.spring.io/snapshot" }
maven { url "https://repo.spring.io/milestone" }
implementation("org.springframework.credhub:spring-credhub-starter:3.0.0-SNAPSHOT")
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.springframework.boot:spring-boot-starter-actuator")
implementation("org.springframework.boot:spring-boot-starter-security")
}

View File

@@ -14,15 +14,11 @@
* limitations under the License.
*/
plugins {
id 'org.asciidoctor.jvm.convert' version '3.3.2'
}
import org.springframework.boot.gradle.plugin.SpringBootPlugin
dependencyManagement {
imports {
mavenBom "org.springframework.boot:spring-boot-dependencies:${springBootVersion}"
mavenBom "io.projectreactor:reactor-bom:${reactorVersion}"
}
plugins {
id 'org.asciidoctor.jvm.convert'
id 'org.springframework.boot' apply false
}
description = "Spring CredHub Documentation"
@@ -32,7 +28,8 @@ configurations {
}
dependencies {
implementation project(":spring-credhub-core")
implementation(platform(SpringBootPlugin.BOM_COORDINATES))
implementation(project(":spring-credhub-core"))
implementation("io.projectreactor:reactor-core")
implementation("org.springframework.boot:spring-boot-autoconfigure")

View File

@@ -14,22 +14,12 @@
* limitations under the License.
*/
description = 'Spring CredHub Integration Tests'
buildscript {
dependencies {
classpath "org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}"
}
repositories {
mavenCentral()
maven { url "https://repo.spring.io/plugins-release" }
}
plugins {
id 'org.springframework.boot'
id 'eclipse'
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
description = 'Spring CredHub Integration Tests'
dependencies {
testImplementation(project(":spring-credhub-starter"))
@@ -43,11 +33,11 @@ dependencies {
if (project.hasProperty("useOkHttp3")) {
testImplementation("com.squareup.okhttp3:okhttp")
} else {
testImplementation("org.apache.httpcomponents.client5:httpclient5:${httpClient5Version}")
testImplementation("org.apache.httpcomponents.client5:httpclient5")
}
testImplementation("org.springframework.boot:spring-boot-starter-test")
testImplementation("org.assertj:assertj-core:${assertJVersion}")
testImplementation("org.assertj:assertj-core")
}
test {
@@ -61,7 +51,3 @@ bootJar {
}
configurations.archives.artifacts.clear()
repositories {
mavenCentral()
}

View File

@@ -14,22 +14,12 @@
* limitations under the License.
*/
description = 'Spring CredHub Reactive Integration Tests'
buildscript {
dependencies {
classpath "org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}"
}
repositories {
mavenCentral()
maven { url "https://repo.spring.io/plugins-release" }
}
plugins {
id 'org.springframework.boot'
id 'eclipse'
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
description = 'Spring CredHub Reactive Integration Tests'
dependencies {
testImplementation(project(":spring-credhub-starter"))
@@ -43,7 +33,7 @@ dependencies {
testImplementation("org.springframework.boot:spring-boot-starter-test")
testImplementation("io.projectreactor:reactor-test")
testImplementation("org.assertj:assertj-core:${assertJVersion}")
testImplementation("org.assertj:assertj-core")
}
test {
@@ -57,7 +47,3 @@ bootJar {
}
configurations.archives.artifacts.clear()
repositories {
mavenCentral()
}

View File

@@ -14,15 +14,10 @@
* limitations under the License.
*/
dependencyManagement {
imports {
mavenBom "org.springframework.boot:spring-boot-dependencies:${springBootVersion}"
}
}
description = 'Spring CredHub Starter'
dependencies {
api(platform("org.springframework.boot:spring-boot-dependencies:${springBootVersion}"))
api(project(':spring-credhub-core'))
api("org.springframework.boot:spring-boot-autoconfigure")
@@ -31,15 +26,16 @@ dependencies {
securityImplementation("org.springframework.security:spring-security-config")
securityImplementation("org.springframework.security:spring-security-oauth2-client")
httpclientImplementation("org.apache.httpcomponents.client5:httpclient5:${httpClient5Version}") {
httpclientImplementation("org.apache.httpcomponents.client5:httpclient5") {
exclude(group: 'commons-logging', module: 'commons-logging')
}
okhttpImplementation("com.squareup.okhttp3:okhttp:${okHttp3Version}")
okhttpImplementation("com.squareup.okhttp3:okhttp")
annotationProcessor(platform("org.springframework.boot:spring-boot-dependencies:${springBootVersion}"))
annotationProcessor("org.springframework.boot:spring-boot-configuration-processor")
testImplementation("org.springframework.boot:spring-boot-starter-test")
testImplementation("org.springframework.boot:spring-boot-starter-web")
testImplementation("org.assertj:assertj-core:${assertJVersion}")
testImplementation("org.assertj:assertj-core")
}