We Are Going To Discuss About Gradle “Entry .classpath is a duplicate but no duplicate handling strategy has been set”. So lets Start this Java Article.
Gradle “Entry .classpath is a duplicate but no duplicate handling strategy has been set”
- Gradle “Entry .classpath is a duplicate but no duplicate handling strategy has been set”
I faced same issue while building with kotlin and gradle 7. Resolve the issue adding the below code to your
build.gradle.kts
.tasks.withType<Jar> { duplicatesStrategy = DuplicatesStrategy.INHERIT }
- “Entry .classpath is a duplicate but no duplicate handling strategy has been set”
I faced same issue while building with kotlin and gradle 7. Resolve the issue adding the below code to your
build.gradle.kts
.tasks.withType<Jar> { duplicatesStrategy = DuplicatesStrategy.INHERIT }
Solution 1
Similar to @korn answer, I solved mine using the EXCLUDE
Strategy;
tasks.withType<Jar>() {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
manifest {
attributes["Main-Class"] = "MainKt"
}
configurations["compileClasspath"].forEach { file: File ->
from(zipTree(file.absoluteFile))
}
}
Original Author Of This Content
Solution 2
jar {
duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
…..
Original Author Of This Content
Solution 3
If you use Kotlin DSL and Gradle 7.0 it may be due to that bug KT-46165
It should be fixed in version 1.5.0.
Original Author Of This Content
Solution 4
I faced same issue while building with kotlin and gradle 7. Resolve the issue adding the below code to your build.gradle.kts
.
tasks.withType<Jar> { duplicatesStrategy = DuplicatesStrategy.INHERIT }
Original Author Of This Content
Conclusion
So This is all About This Tutorial. Hope This Tutorial Helped You. Thank You.