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.
What Does This Do
This is a workspace to try upgrading to Gradle 9.
Motivation
Keep tool up-to-date. Support later JDKs and libraries.
Gradle 9.3 Compatibility Report
Executive Summary
This report documents the compatibility issues encountered when upgrading dd-trace-java to Gradle 9.3.0. While several issues have been resolved, a fundamental blocker remains: Spring Boot 2.x Gradle plugin is incompatible with Gradle 9.
Issues Fixed
1. Provider API Changes (
TestJvmSpec.kt)Commit:
23f79d6821Problem: Gradle 9 changed the Provider API for handling nullable types. The old code used
project.providers.provider<JavaLauncher?> { null }which is no longer compatible.Fix:
File:
buildSrc/src/main/kotlin/datadog/gradle/plugin/testJvmConstraints/TestJvmSpec.kt:1412. Dependency Locking Configuration (
dd-trace-java.dependency-locking.gradle.kts)Commit:
23f79d6821Problem: Gradle 9's new JVM Test Suite plugin automatically creates test configurations when the
javaplugin is applied. The dependency locking configuration was being applied too early, causing conflicts.Fix: Wrap dependency locking in
pluginManager.withPlugin("java"):File:
buildSrc/src/main/kotlin/dd-trace-java.dependency-locking.gradle.kts:13-233. SelfResolvingDependency API Removal (
publish.gradle)Commit:
23f79d6821Problem: The
SelfResolvingDependencyclass was removed from Gradle 9.Fix:
File:
gradle/publish.gradle:414. sourceCompatibility/targetCompatibility Configuration (
benchmark-integration/build.gradle)Commit:
23f79d6821Problem: Gradle 9 requires that
sourceCompatibilityandtargetCompatibilitybe set within thejava {}configuration block rather than at the project root level.Fix:
File:
dd-java-agent/benchmark-integration/build.gradle:28-315. Protobuf Gradle Plugin Updates
Commit:
23f79d6821Problem: Old protobuf plugin versions (0.8.18 and 0.9.4) are not compatible with Gradle 9.
Fix: Update to version
0.9.6Files affected (8 modules):
dd-java-agent/agent-iast/build.gradledd-java-agent/instrumentation/grpc-1.5/build.gradledd-java-agent/instrumentation/armeria/armeria-grpc-0.84/build.gradledd-java-agent/instrumentation/protobuf-3.0/build.gradledd-smoke-tests/springboot-grpc/build.gradledd-smoke-tests/grpc-1.5/build.gradledd-smoke-tests/armeria-grpc/build.gradledd-smoke-tests/armeria-grpc/application/build.gradle6. Configuration Creation Order (
log4j-1.2.4/build.gradle)Commit: (this session)
Problem: Accessing
testImplementationconfiguration before applyingjava.gradlecaused the configuration to be created prematurely. When the Java plugin later tried to create its JVM Test Suite, it failed becausetestImplementationalready existed.Error:
Fix: Move
apply from: "$rootDir/gradle/java.gradle"before theconfigurations {}block.File:
dd-java-agent/instrumentation/log4j/log4j-1.2.4/build.gradle7. Bnd Plugin Compatibility (
osgi/build.gradle)Commit: (this session)
Problem: The bnd plugin version 6.4.0 uses the removed
ConventionAPI (Jar.getConvention()).Error:
Fix: Upgrade bnd plugin from
6.4.0to7.2.1File:
dd-smoke-tests/osgi/build.gradle:48. Project.exec() Removal (
version.gradle)Commit: (this session)
Problem:
project.exec()method was removed in Gradle 9.Error:
Fix: Inject
ExecOperationsvia@Injectand useexecOperations.exec()instead:File:
gradle/version.gradle:11-12, 199. Protobuf Generated Source Path Change
Commit: (this session)
Problem: Protobuf Gradle plugin 0.9.x changed the generated source path from
source(singular) tosources(plural).Error:
Fix:
Files:
dd-java-agent/agent-iast/build.gradle:121dd-java-agent/instrumentation/protobuf-3.0/build.gradle:40Blocking Issue: Spring Boot 2.x Incompatibility
Problem Description
The Spring Boot Gradle plugin versions 2.x use the
Configuration.getUploadTaskName()method which was removed in Gradle 9.Error:
Compatibility Matrix
Affected Smoke Tests
The following smoke tests use Spring Boot 2.x and are incompatible with Gradle 9:
dd-smoke-tests/apm-tracing-disableddd-smoke-tests/springboot-jpadd-smoke-tests/springboot-freemarkerdd-smoke-tests/springboot-java-11dd-smoke-tests/springboot-java-17dd-smoke-tests/springboot-jetty-jspdd-smoke-tests/springboot-thymeleafdd-smoke-tests/springboot-tomcat-jspdd-smoke-tests/springboot-tomcatdd-smoke-tests/springboot-velocitydd-smoke-tests/kafka-2dd-smoke-tests/openfeaturedd-smoke-tests/spring-boot-2.7-webfluxdd-smoke-tests/datastreams/kafkaschemaregistryRoot Cause
Spring Boot 3.0 migrated from Java EE (
javax.*) to Jakarta EE (jakarta.*). This is a breaking change that requires source code modifications:Additionally, Spring Boot 3.x requires Java 17 or later, whereas several smoke tests target Java 8 or 11.
Options
Option 1: Stay on Gradle 8.x
Description: Do not upgrade to Gradle 9 until smoke tests can be migrated to Spring Boot 3.5+.
Option 2: Migrate Smoke Tests to Jakarta EE
Description: Update all affected smoke tests to use Spring Boot 3.5+ and migrate
javax.*imports tojakarta.*.Migration steps per module:
sourceCompatibilityto Java 17+javax.servlet.*→jakarta.servlet.*javax.persistence.*→jakarta.persistence.*Option 3: Exclude Smoke Tests from Gradle 9 Build
Description: Configure the build to skip affected smoke tests when using Gradle 9.
Option 4: Hybrid Approach
Description:
Recommendations
The Gradle 9 compatibility fixes documented in this report should be preserved as they will be needed once the Jakarta EE migration is complete.
Summary of All Files Changed
From commit
23f79d6821(to preserve):buildSrc/.../TestJvmSpec.ktbuildSrc/.../dd-trace-java.dependency-locking.gradle.ktsgradle/publish.gradledd-java-agent/benchmark-integration/build.gradledd-java-agent/agent-iast/build.gradledd-java-agent/instrumentation/grpc-1.5/build.gradledd-java-agent/instrumentation/armeria/armeria-grpc-0.84/build.gradledd-java-agent/instrumentation/protobuf-3.0/build.gradledd-smoke-tests/springboot-grpc/build.gradledd-smoke-tests/grpc-1.5/build.gradledd-smoke-tests/armeria-grpc/build.gradledd-smoke-tests/armeria-grpc/application/build.gradleFrom this session (to preserve):
dd-java-agent/instrumentation/log4j/log4j-1.2.4/build.gradledd-smoke-tests/osgi/build.gradlegradle/version.gradledd-java-agent/agent-iast/build.gradledd-java-agent/instrumentation/protobuf-3.0/build.gradleSpring Boot version changes (reverted - do not use with Gradle 9):
All smoke tests have been reverted to their original Spring Boot 2.x versions since upgrading to 3.5.9 requires jakarta namespace migration.
References