Skip to content

Commit

Permalink
simplify spring starter dependencies (#4848)
Browse files Browse the repository at this point in the history
  • Loading branch information
zeitlinger authored Jul 23, 2024
1 parent 7a7a503 commit 497dd23
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,19 @@ A Bill of Material
([BOM](https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#bill-of-materials-bom-poms))
ensures that versions of dependencies (including transitive ones) are aligned.

Importing the `opentelemetry-bom` and `opentelemetry-instrumentation-bom` BOMs
when using the OpenTelemetry starter is important to ensure version alignment
across all OpenTelemetry dependencies.
To ensure version alignment across all OpenTelemetry dependencies, you must
import the `opentelemetry-instrumentation-bom` BOM when using the OpenTelemetry
starter.

{{% alert title="Note" color="info" %}}

If you import the `spring-boot-dependencies` BOM, you have to declare it after
the OpenTelemetry BOMs.
When using Maven, import the OpenTelemetry BOMs before any other BOMs in your
project. For example, if you import the `spring-boot-dependencies` BOM, you have
to declare it after the OpenTelemetry BOMs.

Gradle selects the
[latest version](https://docs.gradle.org/current/userguide/dependency_resolution.html#sec:version-conflict)
of a dependency when multiple BOMs, so the order of BOMs is not important.

{{% /alert %}}

Expand All @@ -41,13 +46,6 @@ The following example shows how to import the OpenTelemetry BOMs using Maven:
```xml
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-bom</artifactId>
<version>{{% param vers.otel %}}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>io.opentelemetry.instrumentation</groupId>
<artifactId>opentelemetry-instrumentation-bom</artifactId>
Expand All @@ -73,7 +71,6 @@ plugins {

dependencies {
implementation(platform(SpringBootPlugin.BOM_COORDINATES))
implementation(platform("io.opentelemetry:opentelemetry-bom:{{% param vers.otel %}}"))
implementation(platform("io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom:{{% param vers.instrumentation %}}"))
}
```
Expand All @@ -90,7 +87,6 @@ plugins {

dependencyManagement {
imports {
mavenBom("io.opentelemetry:opentelemetry-bom:{{% param vers.otel %}}")
mavenBom("io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom:{{% param vers.instrumentation %}}")
}
}
Expand All @@ -100,7 +96,7 @@ dependencyManagement {

Be careful not to mix up the different ways of configuring things with Gradle.
For example, don't use
`implementation(platform("io.opentelemetry:opentelemetry-bom:{{% param vers.otel %}}"))`
`implementation(platform("io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom:{{% param vers.instrumentation %}}"))`
with the `io.spring.dependency-management` plugin.

{{% /alert %}}
Expand Down
4 changes: 4 additions & 0 deletions static/refcache.json
Original file line number Diff line number Diff line change
Expand Up @@ -1247,6 +1247,10 @@
"StatusCode": 200,
"LastSeen": "2024-01-30T06:05:57.197702-05:00"
},
"https://docs.gradle.org/current/userguide/dependency_resolution.html#sec:version-conflict": {
"StatusCode": 206,
"LastSeen": "2024-07-23T10:18:05.857983751+02:00"
},
"https://docs.greptime.com/user-guide/clients/otlp": {
"StatusCode": 200,
"LastSeen": "2024-01-30T15:24:43.194115-05:00"
Expand Down

0 comments on commit 497dd23

Please sign in to comment.