I have a module with Java and Scala. Project structure is like this:
src
-main
--java
--scala
--resources
When I compile I get (%90 of the times) the error
Execution failed for task ‘:altair.dnn.common:jar’
Entry .class is a duplicate but no duplicate handling strategy has been set. Please refer to Copy - Gradle DSL Version 7.5.1 for details.
I don’t have any Copy in my Gradle file and I don’t see a Copy task.
The class is from Scala - it is not used by Java code (and can’t, since it compiles before) , and yet I see the .class file both in build/classes/java and build/classes/scala
Sometimes when I manually remove the build/classes directory it does pass.
My build.gradle is:
plugins {
id 'altair.dnn.conv.scala-library-conventions'
id 'jacoco'
id 'org.jetbrains.kotlin.jvm' version '1.8.0'
}
tasks.register('coverageTest') {
// jacoco must run only after 'test' task (since it looks for results in specific location)
// so coverageTest must run 'test' task and not e.g. run the tests itself
dependsOn test
finalizedBy jacocoTestReport
}
jacoco {
toolVersion = "0.8.7"
}
dependencies {
implementation 'com.google.protobuf:protobuf-java:3.21.10'
implementation 'jakarta.xml.bind:jakarta.xml.bind-api:2.3.1'
implementation 'org.glassfish.jaxb:jaxb-runtime:2.3.3'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
}