Commit 393e7d7
fix(build): remove Spring Boot 2 Gradle plugin for Gradle 9 compatibility (#5263)
* fix(build): remove Spring Boot 2 Gradle plugin for Gradle 9 compatibility
The Spring Boot 2.7.x Gradle plugin uses removed Gradle APIs
(LenientConfiguration.getFiles()) that are incompatible with Gradle 9.
Library modules (sentry-spring, sentry-spring-boot, sentry-spring-boot-starter):
- Replace SpringBootPlugin.BOM_COORDINATES with direct BOM reference
via version catalog (libs.springboot2.bom)
- Remove the 'apply false' plugin declaration entirely
Sample apps (spring-boot, webflux, otel, netflix-dgs):
- Replace Spring Boot plugin with Shadow plugin for fat JAR creation
- Add application plugin for main class configuration
- Use platform(libs.springboot2.bom) for dependency version management
- Configure shadow JAR to merge Spring metadata files
- Replace BootRun task with JavaExec in otel sample
* fix: set duplicatesStrategy=INCLUDE for shadow JAR spring.factories merge
Shadow plugin 9.x defaults to DuplicatesStrategy.EXCLUDE, which drops
duplicate META-INF/spring.factories entries before transformers can
merge them. Setting INCLUDE allows the AppendingTransformer to see all
entries and properly concatenate spring.factories from all JARs.
Without this, the shadow JAR only contains spring.factories from a
single dependency, causing Spring Boot auto-configuration to fail
(e.g. missing RestTemplateBuilder, no embedded web server).
* fix: remove duplicate shadow plugin entry in version catalog
* Format code
* fix: update system test runner for shadow JAR compatibility
- Auto-detect shadowJar vs bootJar build task based on build.gradle.kts
- Add fallback HTTP readiness check for shadow JAR apps that lack
actuator endpoints (actuator web endpoints don't work in flat JARs)
- Append spring-autoconfigure-metadata.properties in shadow JAR config
* fix(otel): use DuplicatesStrategy.INCLUDE for otel agent shadow JAR
Shadow 9.x enforces duplicatesStrategy before transformers run, so
DuplicatesStrategy.FAIL prevents mergeServiceFiles from merging
inst/META-INF/services/ files that exist in both the upstream OTel
agent JAR and the isolated distro libs. Switching to INCLUDE lets
the transformer see all duplicates and merge them correctly.
* Exclude test-support modules from api validation
* Verbose system test output and wire inputs for them properly
* align coroutines version to 1.9.0 for system tests
* fix(otel): use mergeServiceFiles path instead of include for Shadow 9.x
Shadow 9.x's ServiceFileTransformer strips the `inst/` prefix when using
`include("inst/META-INF/services/*")`, placing merged service files under
`META-INF/services/` instead of `inst/META-INF/services/`. This breaks
the OTel agent's classloader which expects isolated services under `inst/`.
Using `path = "inst/META-INF/services"` preserves the correct output path.
Also add missing `duplicatesStrategy = DuplicatesStrategy.INCLUDE` to
console-otlp, log4j2, and console-opentelemetry-noagent shadow JARs
so that mergeServiceFiles and Log4j2 transformers can see duplicates
before they are deduplicated.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix(otel): add default mergeServiceFiles for bootstrap service relocation
Shadow 9.x only applies package relocations to service files that are
claimed by a ServiceFileTransformer. The ContextStorageProvider service
file at META-INF/services/ was not being relocated because it wasn't
handled by any transformer — only the inst/META-INF/services/ files were.
Adding a default mergeServiceFiles() call ensures bootstrap service files
(like ContextStorageProvider) go through the transformer and get properly
relocated to their shaded paths.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix(spring-boot2): pre-merge Spring metadata for Shadow 9.x compatibility
Shadow 9.x enforces DuplicatesStrategy before transformers run, which
breaks the `append` transformer for spring.factories and other Spring
metadata files. Only the last copy survives instead of being concatenated.
Replace `append` calls with a pre-merge task that manually concatenates
Spring metadata files (spring.factories, spring.handlers, spring.schemas,
spring-autoconfigure-metadata.properties) from the runtime classpath
before the shadow JAR is built. The merged files are included first in
the shadow JAR so they take precedence over duplicates from dependency
JARs.
This fixes the PersonSystemTest failure where @SentrySpan AOP and JDBC
instrumentation weren't working because SentryAutoConfiguration wasn't
properly registered in the merged spring.factories.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Format code
* fix(lint): suppress OldTargetApi for uitest-android module
Lint 8.13.1 (set via android.experimental.lint.version) expects targetSdk 37
but we target 36. This is a test-only module so suppressing is safe.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix(spring-boot2): make mergeSpringMetadata configuration-cache compatible
Resolve the runtime classpath at configuration time (not inside doLast)
so the task doesn't capture Gradle script object references that can't
be serialized by the configuration cache.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* formatting
* fix(spring-boot2): replace from() with doLast JAR patching for spring metadata
The from() approach with DuplicatesStrategy.INCLUDE doesn't work because
dependency JARs' spring.factories overwrites the pre-merged version.
Instead, let the shadow JAR build normally, then use a doLast action
to replace the Spring metadata files in the built JAR with the properly
merged versions using the NIO ZIP filesystem API.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* formatting
* fix(spring-boot2): merge AutoConfiguration.imports + doLast JAR patching
The shadow JAR was missing the embedded web server auto-configuration
because AutoConfiguration.imports (used by SB 2.7+) had duplicate entries
from multiple dependency JARs, with only the last copy surviving.
Add AutoConfiguration.imports to the pre-merge file list and use doLast
JAR patching via NIO ZIP filesystem to replace metadata files after
the shadow JAR is built, avoiding the DuplicatesStrategy issue entirely.
Also suppress OldTargetApi lint for uitest-android-benchmark module.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix(spring-boot2): also merge ManagementContextConfiguration.imports
This file has duplicate entries across actuator JARs and needs the
same pre-merge treatment as AutoConfiguration.imports.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* formatting
* fix(spring-boot2): use separate patchSpringMetadata task for JAR patching
The doLast on shadowJar doesn't run when the task is cached/up-to-date.
Move JAR patching to a separate `patchSpringMetadata` task that is
finalized by shadowJar, ensuring it always runs. Also use recursive
walkTopDown to handle nested directories (e.g. META-INF/spring/).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* formatting
* fix(spring-boot2): revert to doLast on shadowJar for Spring metadata patching
The separate patchSpringMetadata task approach caused regressions — the
finalizedBy relationship didn't reliably execute the patching in CI.
Revert to doLast directly on shadowJar with outputs.upToDateWhen { false }
to ensure the patching always runs. Also use walkTopDown for recursive
directory traversal (needed for META-INF/spring/ subdirectory).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* formatting
* fix(spring-boot2): inline Spring metadata merge into shadowJar doLast
Replace the separate mergeSpringMetadata task with inline doLast on
shadowJar that resolves runtimeClasspath at execution time (not
configuration time). This ensures all project dependency JARs are built
before their spring.factories entries are read and merged.
Verified locally: 20/21 system tests pass. Only PersonSystemTest
'create person works' fails due to @SentrySpan AOP limitation in
shadow JARs.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* formatting
* fix(build): make Spring sample shadowJar patching config-cache safe
* fix(build): merge Spring metadata properties in shadow jars
* fix(build): preserve escaped spring metadata keys
* refactor(samples): drop no-op spring shadow service merging
* test(android): Avoid ANR profiling integration test race
Drive the ANR profiling state-machine test synchronously instead of starting the background polling thread.
The previous version could read the queue-backed profile store while the polling thread was still appending stack traces, which made the release unit test flaky with NoSuchElementException in QueueFile iteration.
Co-Authored-By: Codex <noreply@openai.com>
* fix(test): Require actuator health for Spring readiness
* ref(build): Share Spring metadata file list
Move the Spring metadata entry list into MergeSpringMetadataAction so
the Spring sample shadowJar tasks use one source of truth.
Drop the temporary system-test-runner unit test and keep verification
on the existing Spring Boot system test flow.
Co-Authored-By: Codex <noreply@openai.com>
* docs(build): Document Spring metadata merge action
Explain that MergeSpringMetadataAction patches shadow JARs by
merging Spring metadata with file-specific semantics and by
preserving service-provider registrations from the runtime
classpath.
This keeps the intent of the build logic clear without changing
behavior.
Co-Authored-By: Codex <noreply@openai.com>
* build(opentelemetry): Fail agent shadow duplicates by default
Set the final agent shadowJar to fail on unexpected duplicate entries
while still allowing service descriptors to merge in the bootstrap and
inst paths. This keeps duplicate handling strict without breaking the
service file transformers Shadow still relies on.
Co-Authored-By: Claude <noreply@anthropic.com>
---------
Co-authored-by: Sentry Github Bot <bot+github-bot@sentry.io>
Co-authored-by: Roman Zavarnitsyn <rom4ek93@gmail.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Codex <noreply@openai.com>1 parent 219f319 commit 393e7d7
36 files changed
Lines changed: 586 additions & 733 deletions
File tree
- buildSrc/src/main/java
- gradle
- sentry-android-core/src/test/java/io/sentry/android/core/anr
- sentry-android-integration-tests
- sentry-uitest-android-benchmark
- sentry-uitest-android
- sentry-opentelemetry/sentry-opentelemetry-agent
- sentry-samples
- sentry-samples-console-opentelemetry-noagent
- sentry-samples-console-otlp
- sentry-samples-console
- sentry-samples-jul
- sentry-samples-log4j2
- sentry-samples-logback
- sentry-samples-netflix-dgs
- sentry-samples-spring-7
- sentry-samples-spring-boot-4-opentelemetry-noagent
- sentry-samples-spring-boot-4-opentelemetry
- sentry-samples-spring-boot-4-otlp
- sentry-samples-spring-boot-4-webflux
- sentry-samples-spring-boot-4
- sentry-samples-spring-boot-jakarta-opentelemetry-noagent
- sentry-samples-spring-boot-jakarta-opentelemetry
- sentry-samples-spring-boot-jakarta
- sentry-samples-spring-boot-opentelemetry-noagent
- sentry-samples-spring-boot-opentelemetry
- sentry-samples-spring-boot-webflux-jakarta
- sentry-samples-spring-boot-webflux
- sentry-samples-spring-boot
- sentry-samples-spring-jakarta
- sentry-samples-spring
- sentry-spring-boot-starter
- sentry-spring-boot
- sentry-spring
- sentry-system-test-support/api
- sentry-test-support/api
- test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | | - | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
91 | 93 | | |
92 | 94 | | |
93 | 95 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
65 | 64 | | |
66 | 65 | | |
67 | 66 | | |
68 | 67 | | |
69 | 68 | | |
70 | 69 | | |
71 | | - | |
| 70 | + | |
72 | 71 | | |
73 | 72 | | |
74 | 73 | | |
| |||
159 | 158 | | |
160 | 159 | | |
161 | 160 | | |
| 161 | + | |
162 | 162 | | |
163 | 163 | | |
164 | 164 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
174 | 174 | | |
175 | 175 | | |
176 | 176 | | |
177 | | - | |
| 177 | + | |
178 | 178 | | |
179 | 179 | | |
180 | 180 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| 84 | + | |
| 85 | + | |
84 | 86 | | |
85 | 87 | | |
86 | 88 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
| 77 | + | |
| 78 | + | |
77 | 79 | | |
78 | 80 | | |
79 | 81 | | |
| |||
Lines changed: 13 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
152 | 152 | | |
153 | 153 | | |
154 | 154 | | |
155 | | - | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
156 | 168 | | |
157 | 169 | | |
158 | 170 | | |
| |||
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
51 | 52 | | |
52 | 53 | | |
53 | 54 | | |
| |||
66 | 67 | | |
67 | 68 | | |
68 | 69 | | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
69 | 74 | | |
70 | 75 | | |
71 | 76 | | |
| |||
0 commit comments