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.
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
shadowJartask.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.