Don't publish testing -all jar.
MODIFY
buildSrc/src/main/kotlin/io.opentelemetry.instrumentation.javaagent-testing.gradle.kts
buildSrc/src/main/kotlin/io.opentelemetry.instrumentation.javaagent-testing.gradle.kts
@@ -40,7 +40,7 @@ val testInstrumentation by configurations.creating {
isCanBeResolved = true
}
-tasks.named<ShadowJar>("shadowJar").configure {
+tasks.shadowJar {
configurations = listOf(project.configurations.runtimeClasspath.get(), testInstrumentation)
archiveFileName.set("agent-testing.jar")
@@ -108,6 +108,19 @@ afterEvaluate {
}
}
+// shadowJar is only used for creating a jar for testing, but the shadow plugin automatically adds
+// it to a project's published Java component. Skip it if publishing is configured for this
+// project.
+plugins.withId("maven-publish") {
+ configure<PublishingExtension> {
+ (components["java"] as AdhocComponentWithVariants).run {
+ withVariantsFromConfiguration(configurations["shadowRuntimeElements"]) {
+ skip()
+ }
+ }
+ }
+}
+
configurations.configureEach {
if (name.toLowerCase().endsWith("testruntimeclasspath")) {
// Added by agent, don't let Gradle bring it in when running tests.

Don't publish testing -all jar. (#3493)