From 8350ade66ebda261a4df7436713c47aa8c08586d Mon Sep 17 00:00:00 2001 From: Roman Zavarnitsyn Date: Thu, 5 Nov 2026 12:28:45 +0100 Subject: [PATCH 1/2] build: Align SDK modules to one version through sentry-bom Gradle resolves version conflicts per module, so a build could mix SDK modules of different versions, for example a newer sentry-android-core with an older sentry-android-fragment that the Gradle plugin or another library pulled in. That fails at runtime with NoSuchMethodError or the mixed versions check. The publish conventions now add sentry-bom as a platform to every published library module. Gradle then moves all SDK modules of a consumer to the highest version present. Maven does not apply the dependencyManagement of a dependency's POM, so Maven builds resolve as before. The BOM now also constrains sentry-android-distribution, which is released with the SDK. Refs #5105 Co-Authored-By: Claude Opus 5.5 --- .../io/sentry/gradle/SentryPublishPlugin.kt | 15 +++++++++++++++ sentry-bom/build.gradle.kts | 3 +-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/build-logic/src/main/kotlin/io/sentry/gradle/SentryPublishPlugin.kt b/build-logic/src/main/kotlin/io/sentry/gradle/SentryPublishPlugin.kt index bbf9eb5d770..de8162032e1 100644 --- a/build-logic/src/main/kotlin/io/sentry/gradle/SentryPublishPlugin.kt +++ b/build-logic/src/main/kotlin/io/sentry/gradle/SentryPublishPlugin.kt @@ -16,6 +16,9 @@ import org.gradle.kotlin.dsl.configure class SentryPublishPlugin : Plugin { override fun apply(project: Project) { project.configurePublishing(DistributionContainer::configureForJvm) + // the BOMs are java-platform projects, so they do not depend on themselves + project.plugins.withId("java-library") { project.alignWithBom("api") } + project.plugins.withId("com.android.library") { project.alignWithBom("api") } } } @@ -26,9 +29,21 @@ class SentryPublishPlugin : Plugin { class SentryMultiplatformPublishPlugin : Plugin { override fun apply(project: Project) { project.configurePublishing(DistributionContainer::configureForMultiplatform) + project.plugins.withId("org.jetbrains.kotlin.multiplatform") { + project.alignWithBom("commonMainApi") + } } } +/** + * With sentry-bom as a platform, Gradle resolves all SDK modules of a consumer to one version, the + * highest one present. + */ +private fun Project.alignWithBom(configuration: String) { + val bom = dependencies.project(mapOf("path" to ":sentry-bom")) + dependencies.add(configuration, dependencies.platform(bom)) +} + private fun Project.configurePublishing( configureDistributions: DistributionContainer.(Project) -> Unit ) { diff --git a/sentry-bom/build.gradle.kts b/sentry-bom/build.gradle.kts index ca9cd6e9222..bd10c31f831 100644 --- a/sentry-bom/build.gradle.kts +++ b/sentry-bom/build.gradle.kts @@ -13,8 +13,7 @@ dependencies { !it.name.startsWith("sentry-samples") && it.name != project.name && !it.name.endsWith("-bom") && - !it.name.contains("test", ignoreCase = true) && - !it.name.contains("sentry-android-distribution") + !it.name.contains("test", ignoreCase = true) } .forEach { project -> evaluationDependsOn(project.path) From 52cb9670c39596d7049f6c49f31e34ac40eb1d5a Mon Sep 17 00:00:00 2001 From: Roman Zavarnitsyn Date: Thu, 5 Nov 2026 12:29:04 +0100 Subject: [PATCH 2/2] changelog --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ef9cc8e2795..716e44f6810 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,12 @@ - Quartz `SentryJobListener` can send a monitor config derived from the trigger with check-ins, so Sentry creates or updates the monitor from code. Set the `sentry-upsert-monitor-config` job or trigger data key to `"true"` to send the schedule ([#6216](https://github.com/getsentry/sentry-java/pull/6216)) - Send a monitor config derived from Spring `@Scheduled` with `@SentryCheckIn` check-ins, so Sentry creates or updates the monitor from code. Set `@SentryCheckIn(upsertMonitorConfig = true)` to send the schedule ([#6215](https://github.com/getsentry/sentry-java/pull/6215)) +### Behavioral Changes + +- Gradle builds now resolve all Sentry SDK modules to the same version, the highest one present, because every module depends on `sentry-bom` as a platform ([#6466](https://github.com/getsentry/sentry-java/pull/6466)) + - Before, a build could mix module versions, for example a newer `sentry-android-core` with an older `sentry-android-fragment`, which failed at runtime. Maven builds resolve as before. + - `sentry-bom` now also includes `sentry-android-distribution`. + ### Fixes - Stop marking an OkHttp call span as failed when a connection attempt to one of the host's addresses fails but OkHttp connects on another ([#6472](https://github.com/getsentry/sentry-java/pull/6472))