Skip to content

Circular shadowJar dependencies due to TARGET_JVM_VERSION_ATTRIBUTE #1665

@laurit

Description

@laurit

Expected and Results

See open-telemetry/opentelemetry-java-instrumentation#14388 It seems like when dependency is added with xxx(project(":foo")) it resolves to shadowjar output not the output of the regular jar task, so xxx(project(":foo")) behaves like xxx(project(":foo", configuration = "shadow")).
We bisected the shadow plugin and found that removing

attr.attributeProvider(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, targetJvmVersion)
fixes the issue. With that line removed the build will still fail because mergeServiceFiles() appears to work only with duplicatesStrategy = DuplicatesStrategy.INCLUDE. Not sure whether that is intentional or a bug.

Related environment and versions

shadow plugin 9.0.1
gradle 8.14.3

Reproduction steps

clone the branch used in open-telemetry/opentelemetry-java-instrumentation#14388 and run ./gradlew assemble or ./gradlew build -PskipTests=true

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions