Skip to content

Updating from 9.2.0 to 9.6.1 broke service file merging in composite build #2142

Description

@Privatech38

Expected and Results

Project A depending on project B should not attempt to merge service files of project B.

Related environment and versions

Gradle version 9.6.1, plugin version 9.6.1, Windows.

Reproduction steps

Step 1:
Create a composite build/project where the project being included has dependencies requiring merging of service files like Flyway:

dependencies {
    implementation("org.flywaydb:flyway-core:13.1.0")
    implementation("org.flywaydb:flyway-mysql:13.1.0")
}

and set the strategy as:

    shadowJar {
        duplicatesStrategy = DuplicatesStrategy.EXCLUDE
        mergeServiceFiles()
        filesMatching("META-INF/services/**") {
            duplicatesStrategy = DuplicatesStrategy.INCLUDE
        }
    }

Step 2:
Build the first project which shades the included project, therefore both projects run the shadowJar task.

Step 3:
Analyze both archives. Included project's archive has correctly merged service files when the main project's service files are replaced by one of the two.

Anything else?

Setting the same strategy on main project fixes this.

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