### Basic Java Project in Groovy DSL Source: https://github.com/datadog/dd-trace-java/blob/master/docs/how_to_work_with_gradle.md Example of a basic Java project setup using Groovy DSL. This includes applying the Java plugin, defining dependencies, and registering a simple task. ```gradle plugins { id 'java' } dependencies { implementation 'com.google.guava:guava:32.1.2-jre' } tasks.register('hello') { doLast { println 'Hello from Groovy DSL' } } ``` -------------------------------- ### Basic Java Project in Kotlin DSL Source: https://github.com/datadog/dd-trace-java/blob/master/docs/how_to_work_with_gradle.md Example of a basic Java project setup using Kotlin DSL. This includes applying the Java plugin, defining dependencies, and registering a simple task. Prefer Kotlin DSL for better IDE support and type safety. ```gradle.kts plugins { id("java") } dependencies { implementation("com.google.guava:guava:32.1.2-jre") } tasks.register("hello") { doLast { println("Hello from Kotlin DSL") } } ``` -------------------------------- ### Run Setup Script Source: https://github.com/datadog/dd-trace-java/blob/master/BUILDING.md Execute the setup script to verify your development environment. This script checks for required tools like JDK and Git. ```shell ./setup.sh ``` ```powershell .\setup.ps1 ``` -------------------------------- ### Install Git on Windows Source: https://github.com/datadog/dd-trace-java/blob/master/BUILDING.md Install the Git version control system on Windows using the winget package manager. ```powershell winget install --id git.git ``` -------------------------------- ### Install JDK 21 on Linux Source: https://github.com/datadog/dd-trace-java/blob/master/BUILDING.md Install the OpenJDK 21 package using apt on Linux. ```shell apt install openjdk-21-jdk ``` -------------------------------- ### Install Git on Linux Source: https://github.com/datadog/dd-trace-java/blob/master/BUILDING.md Install the Git version control system on Linux using the apt package manager. ```shell apt install git ``` -------------------------------- ### View Gradle Dependency Configurations Source: https://github.com/datadog/dd-trace-java/blob/master/docs/how_to_work_with_gradle.md Command-line examples for viewing all configurations, a specific configuration's dependency tree, or all resolvable configurations. ```bash # List all configurations ./gradlew :my-project:dependencies # Show a specific configuration's dependency tree ./gradlew :my-project:dependencies --configuration runtimeClasspath # Show all resolvable configurations ./gradlew :my-project:resolvableConfigurations ``` -------------------------------- ### Install Docker Desktop using winget Source: https://github.com/datadog/dd-trace-java/blob/master/BUILDING.md Use winget to install Docker Desktop on Windows. This is an alternative to downloading from the official website. ```pwsh winget install --id Docker.DockerDesktop ``` -------------------------------- ### Full J9 JVM Crash Tracking Example Source: https://github.com/datadog/dd-trace-java/blob/master/docs/manual_crash_tracking_setup.md An example combining custom javacore path and disabling default system dumps for J9 JVMs. ```bash java -Xdump:tool:events=gpf+abort,exec=/opt/datadog/dd_crash_uploader.sh\ %pid \ -Xdump:java:file=/var/log/crashes/javacore.%pid.%seq.txt \ -javaagent:/path/to/dd-java-agent.jar \ -jar your-application.jar ``` -------------------------------- ### Example supported-configurations.json Structure Source: https://github.com/datadog/dd-trace-java/blob/master/docs/add_new_configurations.md Illustrates the structure for defining supported configurations, including version, type, default values, aliases, and optional property keys. ```json { "supportedConfigurations": { "DD_SERVICE": [ { "version": "D", "type": "string", "default": null, "aliases": ["DD_SERVICE_NAME"] } ], "DD_ENV_WITH_TELEMETRY_KEYS": [ { "version": "A", "type": "boolean", "default": "true", "aliases": [], "propertyKeys": ["test.telemetry"] } ] }, "deprecations": { "DD_LEGACY_SERVICE_NAME": "use DD_SERVICE instead" } } ``` -------------------------------- ### Install JDK 21 on Windows Source: https://github.com/datadog/dd-trace-java/blob/master/BUILDING.md Install the Temurin JDK version 21 using the winget package manager on Windows. ```powershell winget install --id EclipseAdoptium.Temurin.21.JDK ``` -------------------------------- ### Context Store Initialization Source: https://github.com/datadog/dd-trace-java/blob/master/docs/how_instrumentations_work.md Demonstrates how to get a ContextStore for a specific carrier and value type. This is typically done within Advice classes. ```java ContextStore store = InstrumentationContext.get( "com.amazonaws.services.sqs.model.ReceiveMessageResult", "java.lang.String"); ``` -------------------------------- ### Gradle Configuration Phase Example Source: https://github.com/datadog/dd-trace-java/blob/master/docs/how_to_work_with_gradle.md Demonstrates code that runs during the configuration phase. Avoid expensive operations or I/O in this phase as it runs on every build invocation. ```gradle plugins { id("java") } // This runs during CONFIGURATION - avoid expensive operations in this phase val expensiveValue = file("some-file.txt").readText() // Bad! tasks.register("myTask") { // Task configuration also runs during configuration phase // But the task ACTION (doLast/doFirst) runs during execution doLast { // This runs during EXECUTION phase println("Executing myTask") } } ``` -------------------------------- ### Gradle Execution Phase Example Output Source: https://github.com/datadog/dd-trace-java/blob/master/docs/how_to_work_with_gradle.md Shows the typical output when Gradle executes tasks during the execution phase, demonstrating the order of operations for a build. ```bash ./gradlew build > Task :compileJava > Task :processResources > Task :classes > Task :jar > Task :assemble > Task :compileTestJava > Task :testClasses > Task :test > Task :check > Task :build ``` -------------------------------- ### Install JDK 21 on macOS Source: https://github.com/datadog/dd-trace-java/blob/master/BUILDING.md Install the Zulu JDK version 21 using Homebrew on macOS. ```shell brew install --cask zulu@21 ``` -------------------------------- ### JApiCmp Example for MongoDB Driver Source: https://github.com/datadog/dd-trace-java/blob/master/docs/how_instrumentations_work.md Example of using the JApiCmp task to compare specific versions of the MongoDB driver artifact. ```shell ./gradlew japicmp -Partifact=org.mongodb:mongodb-driver-sync -Pbaseline=3.11.0 -Ptarget=4.0.0 ``` -------------------------------- ### Verify Java Installation Source: https://github.com/datadog/dd-trace-java/blob/master/docs/manual_crash_tracking_setup.md Checks if the Java executable is available in the system's PATH. ```bash which java ``` -------------------------------- ### Configure Project Name and Subprojects in settings.gradle.kts Source: https://github.com/datadog/dd-trace-java/blob/master/docs/how_to_work_with_gradle.md Example of a `settings.gradle.kts` file to configure the root project name and include subprojects. This is part of the Initialization phase of the Gradle build lifecycle. ```gradle.kts rootProject.name = "my-project" include("module-a") include("module-b") include("module-c:submodule") ``` -------------------------------- ### Adding ClassLoaderMatcher Source: https://github.com/datadog/dd-trace-java/blob/master/docs/how_instrumentations_work.md Consider adding an appropriate `ClassLoaderMatcher` to ensure the instrumentation only activates when a specific class is loaded. This example shows how to add it. ```java @Override public boolean isApplicable(Set targetStores) { return super.isApplicable(targetStores) && // The classloader must contain the given class new ClassLoaderMatcher(named("com.example.MyClass")).matches(classLoader()); } ``` -------------------------------- ### Basic Span Lifecycle in Advice Class Source: https://github.com/datadog/dd-trace-java/blob/master/docs/how_instrumentations_work.md Demonstrates the standard pattern for starting and finishing spans within an Advice class. Use this for typical method instrumentation. ```java @Advice.OnMethodEnter(suppress = Throwable.class) public static AgentScope begin() { final AgentSpan span = startSpan(/* */); DECORATE.afterStart(span); return activateSpan(span); } @Advice.OnMethodExit(suppress = Throwable.class) public static void end(@Advice.Enter final AgentScope scope) { AgentSpan span = scope.span(); DECORATE.beforeFinish(span); scope.close(); span.finish(); } ``` -------------------------------- ### Run All Benchmarks via Docker Source: https://github.com/datadog/dd-trace-java/blob/master/benchmark/README.MD Execute all available benchmarks using the provided shell script. This command automatically handles setup and configuration. Reports will be generated in the `benchmark/reports/` folder. Consider running `docker system prune -af` if you encounter storage errors. ```bash ./run.sh ``` -------------------------------- ### Context Store Declaration Source: https://github.com/datadog/dd-trace-java/blob/master/docs/how_instrumentations_work.md Example of pre-declaring a ContextStore by overriding the contextStore() method in an Advice class. This is required before using the store. ```java @Override public Map contextStore() { return singletonMap( "com.amazonaws.services.sqs.model.ReceiveMessageResult", "java.lang.String" ); } ``` -------------------------------- ### Initialize and Use OpenFeature Client Source: https://github.com/datadog/dd-trace-java/blob/master/products/feature-flagging/feature-flagging-api/README.md Initialize the OpenFeature API, set the Datadog provider, and obtain a client to evaluate feature flags. This example demonstrates fetching a boolean flag with a default value and a user context. ```java import datadog.trace.api.openfeature.Provider; import dev.openfeature.sdk.OpenFeatureAPI; import dev.openfeature.sdk.Client; OpenFeatureAPI api = OpenFeatureAPI.getInstance(); api.setProviderAndWait(new Provider()); Client client = api.getClient(); boolean enabled = client.getBooleanValue("my-feature", false, new MutableContext("user-123")); ``` -------------------------------- ### Apply Method Advice Transformation Source: https://github.com/datadog/dd-trace-java/blob/master/docs/add_new_instrumentation.md Use transformation.applyAdvice() to specify the method to instrument and the name of the Advice class. This example targets the public 'execute' method with no arguments. ```java public void adviceTransformations(AdviceTransformation transformation) { transformation.applyAdvice( isMethod() .and(isPublic()) .and(named("execute")), GoogleHttpClientInstrumentation.class.getName() + "$GoogleHttpClientAdvice" ); } ``` -------------------------------- ### Example Usage of addTestSuite Macro Source: https://github.com/datadog/dd-trace-java/blob/master/docs/how_instrumentations_work.md Demonstrates how to use the addTestSuite macro to define a new test suite named 'latestDepTest'. This is a common pattern for adding new test configurations. ```groovy addTestSuite('latestDepTest') ``` -------------------------------- ### Tag Matching Examples Source: https://github.com/datadog/dd-trace-java/blob/master/docs/how_to_test_with_junit.md Demonstrates various ways to match tags on spans, including default Datadog tags, exact values, custom validation logic, and checking for tag presence. Also shows how to match error tags based on exceptions. ```java // Default DD tags (thread name, runtime ID, sampling, etc.) defaultTags() // Exact value tag("http.status", is(200)) // Custom validation tag("response.body", validates(v -> ((String) v).contains("success"))) // Any value (just check presence) tag("custom.tag", any()) // Error tags from exception error(IOException.class) error(IOException.class, "Connection refused") error(new IOException("Connection refused")) // Check tag presence without value check includes("tag1", "tag2") ``` -------------------------------- ### Initialize and Configure Git Repository Source: https://github.com/datadog/dd-trace-java/blob/master/dd-java-agent/agent-ci-visibility/src/test/resources/ci/git/impacted/build_script.txt Sets up a bare Git repository and a local repository with a remote pointing to the bare repository. Includes initial commits and pushing to the remote. ```bash #!/bin/bash # IMPORTANT: always use relative paths, as tests move the folders to temp dirs base_path="/tmp/impacted/" origin_path="repo_origin" source_path="source_repo" new_clone_path="new_clone" no_remote_path="no_remote" ghub_actions_path="ghub_actions_clone" base_branch="master" feature_branch="feature" mkdir -p $base_path cd $base_path # create origin mkdir -p $origin_path cd $origin_path && git init --bare cd .. # create git repo mkdir -p $source_path && cd $source_path git init && git remote add origin "../$origin_path" echo "Hello, world!" >>README.md && git add README.md && git commit -m "Initial commit" echo "Hello, world!" >>README.md && git add README.md && git commit -m "Update README" git push origin master base_commit=$(git rev-parse HEAD) # create feature branch git checkout -b $feature_branch echo "Feature branch change" >>README.md && git add README.md && git commit -m "Feature branch commit" git push origin $feature_branch cd .. # clone with remote branch cloned into master branch of local repo mkdir -p $new_clone_path && cd $new_clone_path git init git remote add origin "../$origin_path" git fetch origin $feature_branch git reset --hard "origin/$feature_branch" cd .. # remote pointing to non existing repo mkdir -p $no_remote_path && cd $no_remote_path git init echo "base branch file" >>README.md && git add README.md && git commit -m "first commit" git remote add origin "git@git.com:datadog/non_existing_repo.git" cd .. # github actions style clone mkdir -p $ghub_actions_path && cd $ghub_actions_path git init git remote add origin "../$origin_path" git fetch --no-tags --prune --no-recurse-submodules origin $feature_branch git checkout --progress --force -B $feature_branch "refs/remotes/origin/$feature_branch" cd .. echo "BASE COMMIT: $base_commit" # cleanup (cd $origin_path && rm -rf hooks info logs COMMIT_EDITMSG description index README.md) (cd $source_path && rm -rf .git/hooks .git/info .git/logs .git/COMMIT_EDITMSG .git/description .git/index README.md && mv .git git) (cd $new_clone_path && rm -rf .git/hooks .git/info .git/logs .git/COMMIT_EDITMSG .git/description .git/index README.md && mv .git git) (cd $no_remote_path && rm -rf .git/hooks .git/info .git/logs .git/COMMIT_EDITMSG .git/description .git/index README.md && mv .git git) (cd $ghub_actions_path && rm -rf .git/hooks .git/info .git/logs .git/COMMIT_EDITMSG .git/description .git/index README.md && mv .git git) ``` -------------------------------- ### Basic Instrumentation Class Example Source: https://github.com/datadog/dd-trace-java/blob/master/docs/how_instrumentations_work.md An example of an Instrumentation class that extends a TargetSystem class and implements an Instrumenter interface. This class is annotated with @AutoService(InstrumenterModule.class). ```java import datadog.trace.agent.tooling.Instrumenter; import datadog.trace.agent.tooling.InstrumenterModule; @AutoService(InstrumenterModule.class) public class RabbitChannelInstrumentation extends InstrumenterModule.Tracing implements Instrumenter.ForTypeHierarchy {/* */ } ``` -------------------------------- ### Basic Instrumentation Test Example Source: https://github.com/datadog/dd-trace-java/blob/master/docs/how_to_test_with_junit.md An example of a basic instrumentation test using `AbstractInstrumentationTest`. It demonstrates exercising instrumented code and asserting the resulting trace structure. ```java class HttpInstrumentationTest extends AbstractInstrumentationTest { @Test void testHttpRequest() { // exercise the instrumented code makeHttpRequest("http://example.com/api"); // assert the trace structure assertTraces( trace( span().root().operationName("http.request").resourceName("GET /api"))); } } ``` -------------------------------- ### Basic Java Agent JVM Startup Source: https://context7.com/datadog/dd-trace-java/llms.txt Attach the `dd-java-agent.jar` using the `-javaagent` JVM argument for automatic instrumentation of supported frameworks. Configure service name, environment, version, and agent host/port. ```bash # Download the latest agent curl -Lo dd-java-agent.jar \ https://dtdg.co/latest-java-tracer # Basic startup — auto-instruments all supported frameworks java -javaagent:dd-java-agent.jar \ -Ddd.service=my-service \ -Ddd.env=production \ -Ddd.version=1.2.3 \ -Ddd.agent.host=localhost \ -Ddd.trace.agent.port=8126 \ -jar myapp.jar ``` -------------------------------- ### Trace Assertion Options: Sort by Start Time Source: https://github.com/datadog/dd-trace-java/blob/master/docs/how_to_test_with_junit.md Configure `assertTraces` to sort received traces by their start time before performing the assertion. Use the `SORT_BY_START_TIME` option. ```java // Sort traces by start time before assertion assertTraces(SORT_BY_START_TIME, trace(span().root().operationName("first")), trace(span().root().operationName("second"))); ``` -------------------------------- ### Build entire project with tests Source: https://github.com/datadog/dd-trace-java/blob/master/BUILDING.md Clean and build the entire project, including running all tests. Be aware that this process can be lengthy and may encounter flaky tests. ```shell ./gradlew clean build ``` -------------------------------- ### Clone dd-trace-java repository Source: https://github.com/datadog/dd-trace-java/blob/master/BUILDING.md Clone the dd-trace-java repository including all submodules. Ensure you have git installed and configured. ```shell git clone --recurse-submodules git@github.com:DataDog/dd-trace-java.git ``` -------------------------------- ### Context Store Usage - Get Source: https://github.com/datadog/dd-trace-java/blob/master/docs/how_instrumentations_work.md Illustrates retrieving a value from a ContextStore using the exact same carrier object that was used for storage. ```java String stored = store.get(response); // "my string" ``` -------------------------------- ### Initialize and Populate Git Repository Source: https://github.com/datadog/dd-trace-java/blob/master/dd-java-agent/agent-ci-visibility/src/test/resources/ci/git/shallow_with_origin/build_script.txt This script initializes a bare Git repository for the origin and a working copy to populate it with commits. It configures user details and pushes the initial commits to the origin. ```bash #!/bin/bash set -e # IMPORTANT: always use relative paths, as tests move the folders to temp dirs base_path="/tmp/shallow_with_origin/" origin_path="origin" repo_path="repo" rm -rf $base_path mkdir -p $base_path cd $base_path # create bare origin mkdir -p $origin_path cd $origin_path && git init --bare --initial-branch=master cd .. # create working copy to populate origin with commits mkdir -p work && cd work git init --initial-branch=master git remote add origin "../$origin_path" git config user.email "test-author@example.com" git config user.name "Test Author" # create 10 commits for i in $(seq 0 9); do echo "content $i" >> "file${i}.txt" git add . git commit -m "Commit message ${i}" done git push origin master cd .. ``` -------------------------------- ### Print Load Generator Options Source: https://github.com/datadog/dd-trace-java/blob/master/dd-java-agent/load-generator/Readme.md To view all available command-line options for the load generator, use the '--help' argument with Gradle. ```bash --args='--help' ``` -------------------------------- ### Replace Dependency Globally with Resolution Strategy Source: https://github.com/datadog/dd-trace-java/blob/master/docs/how_to_work_with_gradle.md Use `resolutionStrategy.eachDependency` to globally replace a dependency with a different one, for example, to apply security fixes. ```gradle configurations.configureEach { resolutionStrategy.eachDependency { // Replace log4j with reload4j (security fix) if (requested.group == "log4j" && requested.name == "log4j") { useTarget("ch.qos.reload4j:reload4j:${requested.version}") because("log4j has critical vulnerabilities") } } } ``` -------------------------------- ### Launch Load Generator with Gradle Source: https://github.com/datadog/dd-trace-java/blob/master/dd-java-agent/load-generator/Readme.md Run the load generator using Gradle from the root of the repository. Specify arguments like '--rate 10' to control the simulation. ```bash ./gradlew launch --args='--rate 10' ``` ```bash ./gradlew :dd-java-agent:load-generator:launch --args='--rate 10' ``` -------------------------------- ### Show Applied Plugins in Gradle Source: https://github.com/datadog/dd-trace-java/blob/master/docs/how_to_work_with_gradle.md Use the ':my-project:buildEnvironment' task to display information about the build environment, including applied plugins. ```bash # Show applied plugins ./gradlew :my-project:buildEnvironment ``` -------------------------------- ### Lazy Configuration Access (Kotlin DSL) Source: https://github.com/datadog/dd-trace-java/blob/master/docs/how_to_work_with_gradle.md Avoid eagerly resolving configurations with `configurations.getByName()`. Use `configurations.named()` to get a lazy provider for the configuration. ```gradle // ❌ Eager - resolves configuration immediately val runtimeClasspath = configurations.getByName("runtimeClasspath") // ✅ Lazy - returns a provider val runtimeClasspath = configurations.named("runtimeClasspath") ``` -------------------------------- ### Display Git Configuration Files Source: https://github.com/datadog/dd-trace-java/blob/master/dd-java-agent/agent-ci-visibility/src/test/resources/ci/git/shallow_with_origin/build_script.txt Prints the content of the Git configuration files for both the origin and the shallow clone to verify the path updates. ```bash echo "=== ORIGIN CONFIG ===" cat $origin_path/config echo "" echo "=== REPO CONFIG ===" cat $repo_path/git/config echo "" ``` -------------------------------- ### Format Code with Gradle Source: https://github.com/datadog/dd-trace-java/blob/master/AGENTS.md Applies code formatting using google-java-format, enforced by Spotless. Run `spotlessApply` before committing. ```shell ./gradlew spotlessApply ``` ```shell ./gradlew spotlessCheck ``` -------------------------------- ### List All Tasks in a Gradle Project Source: https://github.com/datadog/dd-trace-java/blob/master/docs/how_to_work_with_gradle.md The ':my-project:tasks --all' command lists all available tasks for a specific project, including hidden ones. ```bash # List all tasks in a project ./gradlew :my-project:tasks --all ``` -------------------------------- ### Docker Java Agent and J9 Crash Tracking Setup Source: https://github.com/datadog/dd-trace-java/blob/master/docs/manual_crash_tracking_setup.md Sets environment variables in a Dockerfile to enable the Datadog Java agent and J9 crash tracking. ```dockerfile ENV JAVA_TOOL_OPTIONS="-javaagent:/opt/datadog/dd-java-agent.jar" # For J9 JVMs, add: ENV JAVA_TOOL_OPTIONS="-javaagent:/opt/datadog/dd-java-agent.jar -Xdump:tool:events=gpf+abort,exec=/opt/datadog/dd_crash_uploader.sh\ %pid" ``` -------------------------------- ### Enable Configuration Cache and Report Problems Source: https://github.com/datadog/dd-trace-java/blob/master/docs/how_to_work_with_gradle.md Run Gradle builds with the --configuration-cache flag to enable caching and --configuration-cache-problems=warn to generate detailed reports on violations. ```bash # Run with configuration cache and see what fails ./gradlew build --configuration-cache # Generate a detailed report ./gradlew build --configuration-cache --configuration-cache-problems=warn ``` -------------------------------- ### Set JAVA_HOME Environment Variable on Windows Source: https://github.com/datadog/dd-trace-java/blob/master/BUILDING.md Configure the JAVA_HOME environment variable for the current user on Windows. Replace the path with your actual JDK 21 installation directory. ```powershell [Environment]::SetEnvironmentVariable("JAVA_HOME", "C:\Program Files\Eclipse Adoptium\jdk-21.x.x-hotspot", [EnvironmentVariableTarget]::User) ``` -------------------------------- ### Create Gradle Test Suites Source: https://github.com/datadog/dd-trace-java/blob/master/docs/how_to_work_with_gradle.md Use helper functions to create new test suites, extending existing ones and specifying source directories. This is useful for organizing different testing scenarios. ```Gradle addTestSuite('latestDepTest') addTestSuiteExtendingForDir('latestDepForkedTest', 'latestDepTest', 'latestDepTest') ``` -------------------------------- ### Making HTTP Requests to Trigger RabbitMQ Communication Source: https://github.com/datadog/dd-trace-java/blob/master/dd-smoke-tests/spring-boot-rabbit/README.md Example curl command to send a message to the running Spring Boot application, initiating the RabbitMQ communication flow. ```bash curl "http://localhost:8888/roundtrip/foo" ``` -------------------------------- ### Raw Key Configuration with @WithConfig Source: https://github.com/datadog/dd-trace-java/blob/master/docs/how_to_test_with_junit.md Use `addPrefix = false` in @WithConfig to skip the automatic `dd.` or `DD_` prefix for configuration keys, allowing direct use of keys like OTEL_SERVICE_NAME. ```java @WithConfig(key = "OTEL_SERVICE_NAME", value = "test", env = true, addPrefix = false) ``` -------------------------------- ### Kubernetes Java Agent and J9 Crash Tracking Setup Source: https://github.com/datadog/dd-trace-java/blob/master/docs/manual_crash_tracking_setup.md Configures environment variables in a Kubernetes deployment to enable the Datadog Java agent and J9 crash tracking. ```yaml env: - name: JAVA_TOOL_OPTIONS value: "-javaagent:/opt/datadog/dd-java-agent.jar" # For J9 JVMs: - name: JAVA_TOOL_OPTIONS value: "-javaagent:/opt/datadog/dd-java-agent.jar -Xdump:tool:events=gpf+abort,exec=/opt/datadog/dd_crash_uploader.sh\ %pid" ``` -------------------------------- ### Show Resolvable Configurations in Gradle Source: https://github.com/datadog/dd-trace-java/blob/master/docs/how_to_work_with_gradle.md The ':my-project:resolvableConfigurations' task lists all configurations that can be resolved by the project. ```bash # Show all resolvable configurations ./gradlew :my-project:resolvableConfigurations ``` -------------------------------- ### Set JAVA_HOME Environment Variable Source: https://github.com/datadog/dd-trace-java/blob/master/BUILDING.md Configure the JAVA_HOME environment variable to point to your JDK 21 installation. This is typically done by appending an export command to your shell configuration file. ```shell export JAVA_HOME=//jdk-21.x.x ``` -------------------------------- ### Define Versions and Libraries in Version Catalog Source: https://github.com/datadog/dd-trace-java/blob/master/docs/how_to_work_with_gradle.md Define library versions and their corresponding modules in the `gradle/libs.versions.toml` file for consistent dependency management. ```toml # gradle/libs.versions.toml [versions] byte-buddy = "1.18.3" slf4j = "1.7.30" junit5 = "5.14.1" [libraries] bytebuddy = { module = "net.bytebuddy:byte-buddy", version.ref = "byte-buddy" } slf4j = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" } junit-jupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junit5" } ``` -------------------------------- ### List Integrations in JAR Source: https://github.com/datadog/dd-trace-java/blob/master/docs/add_new_instrumentation.md Confirms that your new integration is included in the built JAR by listing all integrations present. This is a useful verification step after building the tracer. ```shell java -jar dd-java-agent.jar --list-integrations ```