feat(auto-install): Auto-install sentry-opentelemetry-bom#266
Closed
adinauer wants to merge 1 commit into
Closed
Conversation
Align OpenTelemetry dependency versions with the versions Sentry was tested against whenever a project uses a Sentry OpenTelemetry integration (excluding the standalone agent and the BOM itself). Maven resolves BOM imports during effective-model building, before the plugin's afterProjectsRead hook runs, so a late-injected import-scope BOM is a no-op. Instead the plugin resolves sentry-opentelemetry-bom at the managed Sentry version, expands it into concrete OpenTelemetry versions, and applies them to the project's dependencyManagement: versions inherited from a parent or another BOM (e.g. Spring Boot) are overwritten in place, unmanaged artifacts get a new managed entry, and versions the user pinned explicitly are left untouched (with a warning when they differ). Add a skipInstallOpenTelemetryBom opt-out and a telemetry tag. Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
Instructions and example for changelogPlease add an entry to Example: ## Unreleased
### Features
- Auto-install sentry-opentelemetry-bom ([#266](https://github.com/getsentry/sentry-maven-plugin/pull/266))If none of the above apply, you can opt out of this check by adding |
Member
Author
|
Superseded: we're pivoting away from auto-installing/rewriting the BOM. In Maven, overwriting inherited dependencyManagement is too magic, and the real risk is a silent OpenTelemetry downgrade (e.g. Spring Boot forcing OTel below what Sentry's sentry-opentelemetry-* artifacts need). New PR instead detects that downgrade and fails the build with instructions to import sentry-opentelemetry-bom — mirroring sentry-android-gradle-plugin#1350. Replacing this PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Builds on top of #265.
What
Auto-installs
io.sentry:sentry-opentelemetry-bomto align OpenTelemetry dependency versions with the versions Sentry was tested against, whenever a project uses a Sentry OpenTelemetry integration (excluding the standalonesentry-opentelemetry-agentand the BOM itself).Why the mechanism differs from the Gradle plugin
Maven resolves BOM imports during effective-model building, which happens before the plugin's
afterProjectsReadhook. A late-injected import-scope BOM is therefore a no-op (verified experimentally). Instead the plugin:sentry-opentelemetry-bomat the managed Sentry version (via fix(auto-install): Use Sentry BOM version for installs #265'sManagedSentryVersionResolver, with SDK fallback) and expands it into concrete OpenTelemetry versions usingProjectBuilder.dependencyManagement:<dependencyManagement>or explicit direct<version>), warning when they differ from Sentry's tested version.This wins over Spring Boot dependency management (both
spring-boot-starter-parentand importedspring-boot-dependencies) without turning transitive artifacts into direct dependencies.Config
Opt out with
<skipInstallOpenTelemetryBom>true</skipInstallOpenTelemetryBom>. Adds aSENTRY_installOpenTelemetryBomtelemetry tag.Notes
sentry-opentelemetry-bomis published for the resolved Sentry version.Tests
OpenTelemetryBomInstallerTest(detection, expand, skip/overwrite/add, user-pin respect + warning).OpenTelemetryBomAutoInstallTestIT— Spring Boot parent alignment, transitive alignment, user-pin respect + warn, disabled flag, agent no-op, BOM-already-imported.Co-authored with Claude.