This feature allows publishing dd-trace-java snapshot versions that depend on a ddprof SNAPSHOT version with an incremented minor version.
ddprof Version Calculation: Current ddprof version X.Y.Z → Dependency becomes X.(Y+1).0-SNAPSHOT
Example: ddprof 1.34.4 → Uses dependency 1.35.0-SNAPSHOT
To avoid overwriting standard snapshot artifacts, builds with -PddprofUseSnapshot will have a -ddprof qualifier added to their version:
- Standard snapshot:
1.58.0-SNAPSHOT - With ddprof snapshot:
1.58.0-ddprof-SNAPSHOT
This ensures that both versions can coexist in Maven Central Snapshots repository without conflicts.
To verify that the ddprof snapshot version is correctly calculated and applied:
./gradlew -PddprofUseSnapshot :dd-java-agent:ddprof-lib:dependencies --configuration runtimeClasspathLook for the output:
Using ddprof snapshot version: X.Y.0-SNAPSHOTModified version for dd-trace-java: 1.58.0-SNAPSHOT -> 1.58.0-ddprof-SNAPSHOTddprof-lib: Using ddprof SNAPSHOT version X.Y.0-SNAPSHOT- Dependency resolution showing:
com.datadoghq:ddprof:X.Y.Z -> X.(Y+1).0-SNAPSHOT
To build the project with the ddprof snapshot dependency:
./gradlew build -PddprofUseSnapshotTo publish artifacts with the ddprof snapshot dependency:
./gradlew publishToSonatype -PddprofUseSnapshot -PskipTestsNote: You must have the required credentials configured:
MAVEN_CENTRAL_USERNAMEMAVEN_CENTRAL_PASSWORDGPG_PRIVATE_KEYGPG_PASSWORD
A GitLab CI job named deploy_snapshot_with_ddprof_snapshot is available for manual execution.
To trigger:
- Navigate to the pipeline in GitLab CI
- Find the
deploy_snapshot_with_ddprof_snapshotjob in thepublishstage - Click the manual play button to trigger it
What it does:
- Builds dd-trace-java with
-PddprofUseSnapshot - Publishes to Maven Central Snapshots repository
- Produces artifacts with the ddprof snapshot dependency
When to use:
- Testing integration with unreleased ddprof features
- Validating compatibility before ddprof release
- Creating test builds for early adopters
gradle/ddprof-override.gradle- Calculates snapshot version and stores it for convention pluginsbuild.gradle.kts- Applies the ddprof-snapshot configurationbuildSrc/src/main/kotlin/dd-trace-java.profiling-ddprof-override.gradle.kts- Convention plugin for dependency overridebuildSrc/src/main/kotlin/datadog/gradle/plugin/version/TracerVersionPlugin.kt- Enhanced to support version qualifiersdd-java-agent/ddprof-lib/build.gradle- Applies the convention plugin.gitlab-ci.yml- New CI job for snapshot publishing
- The Gradle property
-PddprofUseSnapshotactivates the feature - The configuration reads
gradle/libs.versions.tomlto get the current ddprof version - Version is parsed using regex:
ddprof = "X.Y.Z" - Snapshot version is calculated:
X.(Y+1).0-SNAPSHOTand stored inrootProject.ext.ddprofSnapshotVersion - The dd-trace-java version is modified to add a
-ddprofqualifier:1.58.0-SNAPSHOT→1.58.0-ddprof-SNAPSHOT- This prevents overwriting standard snapshot artifacts
- Users can also explicitly set this via
-PtracerVersion.qualifier=ddprof
- The
dd-trace-java.profiling-ddprof-overrideconvention plugin is applied to projects that depend on ddprof - The convention plugin overrides ddprof dependencies to use the snapshot version
- The build and publish proceed with the modified version and overridden dependency
The override is applied via a convention plugin to only the projects that need it:
// Convention plugin: dd-trace-java.profiling-ddprof-override
if (rootProject.hasProperty("ddprofUseSnapshot")) {
val ddprofSnapshotVersion = rootProject.property("ddprofSnapshotVersion").toString()
configurations.all {
resolutionStrategy.eachDependency {
if (requested.group == "com.datadoghq" && requested.name == "ddprof") {
useVersion(ddprofSnapshotVersion)
because("Using ddprof snapshot version for integration testing")
}
}
}
}Projects apply this plugin explicitly in their build files:
plugins {
id "dd-trace-java.profiling-ddprof-override"
}This ensures that only projects that actually depend on ddprof are affected by the override.
- Only works with semantic versioning in format
X.Y.Z - Requires ddprof SNAPSHOT to be published to Maven Central Snapshots repository
- Cannot override local JAR files specified with
-Pddprof.jar=/path/to/jar
Cause: The calculated ddprof snapshot version doesn't exist in Maven Central Snapshots.
Solutions:
- Verify ddprof has published the snapshot version
- Check Maven Central Snapshots repository: https://central.sonatype.com/repository/maven-snapshots/
- Wait for ddprof CI to complete if a new snapshot is being published
Cause: The property might not be correctly set or parsed.
Solutions:
- Ensure you're using
-PddprofUseSnapshot(not-DddprofUseSnapshot) - Check Gradle output for "Using ddprof snapshot version" message
- Run with
--infoflag to see detailed dependency resolution logs