javaagent-gradle-plugin
javaagent-gradle-plugin copied to clipboard
Error if otelExtension is not set in dependencies
I've recently tried upgrading our custom otel distribution from 0.5.2. to 0.7.0 and encountered the following error:
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':opentelemetry-java-agent:extendedAgent'.
> Expected configuration ':opentelemetry-java-agent:otelExtension' to contain exactly one file, however, it contains no files.
The stacktrace:
Caused by: java.lang.IllegalStateException: Expected configuration ':opentelemetry-java-agent:otelExtension' to contain exactly one file, however, it contains no files.
at org.gradle.api.internal.file.AbstractFileCollection.getSingleFile(AbstractFileCollection.java:153)
at org.gradle.api.internal.artifacts.configurations.DefaultUnlockedConfiguration_Decorated.getSingleFile(Unknown Source)
at com.ryandens.javaagent.otel.JavaagentOTelModificationPlugin$apply$extendedAgent$1$3.invoke(JavaagentOTelModificationPlugin.kt:57)
at com.ryandens.javaagent.otel.JavaagentOTelModificationPlugin$apply$extendedAgent$1$3.invoke(JavaagentOTelModificationPlugin.kt:57)
at com.ryandens.javaagent.otel.JavaagentOTelModificationPlugin$apply$extendedAgent$1.invoke$lambda$2(JavaagentOTelModificationPlugin.kt:57)
We don't use otelExtension
in our dependencies but it seems like it is now required after this change
If I add it in (based on the example in that PR) it works again.
dependencies {
otel(projectLibs.opentelemetry.javaagent)
// TODO it seems like otelExtension is now mandatory? i.e.
// otelExtension("io.opentelemetry.contrib:opentelemetry-samplers:1.12.0-alpha")
otelInstrumentation(project(":otel-extensions", "shadow"))
}