Skip to content

Commit b05ab35

Browse files
authored
Replace global dependency management with version catalog (#6080)
Completely removes dependencies.gradle which acted as a global dependency management file for the whole build. We previously introduced a version catalog and these changes make full use of it. Individual dependency versions are managed in the catalog and the dependencies are referenced using the type-safe API where they are declared. This should alleviate confusion contributors have about where to put versions and how to declare dependencies. It also avoids needless dependency management in all sub-projects even for dependencies that are only used in one place. This also removes the global dependency management via the BOMs that were declared in dependencies.gradle. Instead, the BOMs are declared in the projects that use them at the appropriate scope. An exception to this is the JUnit BOM because each 'java-library' project should have tests and use JUnit, so it is added to all of them from the root build.gradle.
1 parent 8ff920f commit b05ab35

File tree

44 files changed

+169
-288
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+169
-288
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ apply plugin: 'com.netflix.nebula.release'
5757
release.defaultVersionStrategy = nebula.plugin.release.git.opinion.Strategies.SNAPSHOT
5858

5959
apply plugin: 'io.github.gradle-nexus.publish-plugin'
60-
apply from: 'dependencies.gradle'
6160

6261
allprojects {
6362
group = 'io.micrometer'
@@ -87,6 +86,7 @@ subprojects {
8786
} else {
8887
apply plugin: 'java-library'
8988
dependencies {
89+
testImplementation platform(libs.junitBom)
9090
testImplementation libs.junitJupiter
9191
testRuntimeOnly libs.junitPlatformLauncher
9292
}

dependencies.gradle

Lines changed: 0 additions & 111 deletions
This file was deleted.

docs/build.gradle

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,28 +41,30 @@ compileTestJava {
4141

4242
dependencies {
4343
implementation project(':micrometer-core')
44-
implementation 'io.micrometer:context-propagation'
45-
implementation 'ch.qos.logback:logback-classic'
46-
implementation 'org.slf4j:slf4j-api'
44+
implementation libs.contextPropagation
45+
implementation libs.logback12
46+
implementation libs.slf4jApi
4747

4848
testImplementation project(':micrometer-test')
4949
testImplementation project(':micrometer-observation-test')
5050
testImplementation project(':micrometer-registry-otlp')
5151
testImplementation libs.aspectjweaver
52-
testImplementation 'org.assertj:assertj-core'
52+
testImplementation libs.assertj
5353
// needed for OtlpMeterRegistryCustomizationTest
5454
testRuntimeOnly libs.okhttp
5555
testImplementation(libs.spring6.context)
56+
testImplementation platform(libs.reactorBom)
5657
testImplementation 'io.projectreactor:reactor-core'
5758
testImplementation 'io.projectreactor:reactor-test'
59+
testImplementation platform(libs.nettyBom)
5860
testImplementation 'io.netty:netty-transport'
59-
testImplementation 'org.apache.httpcomponents.client5:httpclient5'
61+
testImplementation libs.httpcomponents.client5
6062
testImplementation libs.javalin
6163
// Kafka binder IT dependencies
62-
testImplementation 'org.apache.kafka:kafka-clients'
63-
testImplementation 'org.testcontainers:testcontainers'
64-
testImplementation 'org.testcontainers:junit-jupiter'
65-
testImplementation 'org.testcontainers:kafka'
64+
testImplementation libs.kafkaClients
65+
testImplementation libs.testcontainers
66+
testImplementation libs.testcontainers.junitJupiter
67+
testImplementation libs.testcontainers.kafka
6668
}
6769

6870
antora {

gradle/libs.versions.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,6 @@ grpcApi = { module = "io.grpc:grpc-api", version.ref = "grpc" }
114114
grpcCore = { module = "io.grpc:grpc-core", version.ref = "grpc" }
115115
grpcInprocess = { module = "io.grpc:grpc-inprocess", version.ref = "grpc" }
116116
grpcServices = { module = "io.grpc:grpc-services", version.ref = "grpc" }
117-
grpcStubs = { module = "io.grpc:grpc-stubs", version.ref = "grpc" }
118-
grpcAlts = { module = "io.grpc:grpc-alts", version.ref = "grpc" }
119117
grpcTestingProto = { module = "io.grpc:grpc-testing-proto", version.ref = "grpc" }
120118
grpcKotlinStub = { module = "io.grpc:grpc-kotlin-stub", version.ref = "grpcKotlin" }
121119
guava = { module = "com.google.guava:guava", version.ref = "guava" }

implementations/micrometer-registry-appoptics/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
dependencies {
22
api project(':micrometer-core')
33

4-
implementation 'org.slf4j:slf4j-api'
4+
implementation libs.slf4jApi
55

66
testImplementation project(':micrometer-test')
77
testImplementation libs.mockitoCore5
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
dependencies {
22
api project(':micrometer-core')
33

4-
api 'com.netflix.spectator:spectator-reg-atlas'
4+
api libs.spectatorAtlas
55

66
testImplementation project(':micrometer-test')
77
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
dependencies {
22
api project(':micrometer-core')
33

4-
api 'com.microsoft.azure:applicationinsights-core'
5-
implementation 'org.slf4j:slf4j-api'
4+
api libs.applicationInsights
5+
implementation libs.slf4jApi
66

77
testImplementation project(':micrometer-test')
88
// required by jdk 9+
9-
testRuntimeOnly 'javax.xml.bind:jaxb-api'
9+
testRuntimeOnly libs.jaxbApi
1010
}

implementations/micrometer-registry-cloudwatch2/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ description = 'MeterRegistry implementation for publishing to CloudWatch using t
33
dependencies {
44
api project(':micrometer-core')
55

6-
api 'software.amazon.awssdk:cloudwatch'
7-
implementation 'org.slf4j:slf4j-api'
6+
api libs.cloudwatch2
7+
implementation libs.slf4jApi
88

99
testImplementation project(':micrometer-test')
1010
testImplementation libs.mockitoCore5

implementations/micrometer-registry-datadog/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
dependencies {
22
api project(':micrometer-core')
33

4-
implementation 'org.slf4j:slf4j-api'
4+
implementation libs.slf4jApi
55

66
testImplementation project(':micrometer-test')
77
testImplementation libs.mockitoCore5
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
dependencies {
22
api project(':micrometer-core')
33

4-
implementation 'org.slf4j:slf4j-api'
4+
implementation libs.slf4jApi
55

6-
implementation 'com.dynatrace.metric.util:dynatrace-metric-utils-java'
6+
implementation(libs.dynatraceUtils)
77

88
testImplementation project(':micrometer-test')
99
testImplementation libs.mockitoCore5
10-
testImplementation 'com.fasterxml.jackson.core:jackson-databind'
11-
testImplementation 'org.awaitility:awaitility'
10+
testImplementation libs.jacksonDatabind
11+
testImplementation libs.awaitility
1212
}

0 commit comments

Comments
 (0)