Gradle jvmProcessResources fails with "duplicate" file

My build is failing and it makes no sense. Anyone know what this is, or how to debug it?

Execution failed for task ‘:jvmProcessResources’.
Entry log4j2.xml is a duplicate but no duplicate handling strategy has been set. Please refer to for details.

That link is a 404.

I only have one log4j2.xml file in my project.

The essential information – the location of these alleged copies of log4j2.xml – is of course not given in the error message.

I tried --debug or --info flags, but there is still no useful information.

I’m using plugin kotlin("multiplatform") version "1.5.0"

Seems like a bug to me. If I add withJava(), then every file in my src/jvmMain/resources generates an error or warning as a duplicate.

kotlin {
    jvm {
        compilations.all { ... }

This appears to “fix” it so now it just prints a bunch of warnings…

tasks.named<Copy>("jvmProcessResources") {
    duplicatesStrategy = DuplicatesStrategy.WARN

It is not a bug per se. Gradle 7 just changed the default way it treated duplicate files in copy task. Now it asks to explicitly state that files must be replaced. You can use DuplicateStrategy.REPLACE (or whatever the name, i do not remember) and it will work without exceptions.

But I have no duplicate files. It’s just considering everything a duplicate when I add withJava. I only have one resources folder.

It is not a problem, just add DuplicationStrategy.

I have the same problem. I have exactly 1 resource file in my multiplatform project and it is in jvmTest/resources. Adding the duplication strategy did not resolve the problem :frowning:

Same issue on with in kotlin 1.6.10… It is my proto shemas that are detected as duplucate…

I did the same than @rnikander but with type DSL

tasks.withType<ProcessResources> {
    duplicatesStrategy = DuplicatesStrategy.INCLUDE