Hi guys, I have a strange error raised by KotlinDc...
# javascript
g
Hi guys, I have a strange error raised by KotlinDce:
Copy code
error: duplicate target file will be created for '/Users/gaetan/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-js/1.2.61/6e6ada4e826d8c66053f9383a6778b2324853f2/kotlin-stdlib-js-1.2.61.jar!kotlin.js' and '/Users/gaetan/dev/data2viz/time/d2v-time-js/build/libs/d2v-time-js-0.6.0.jar!lib/kotlin.js
Has anyone already seen this message and understood the problem?
c
yes
it throws such error when u have a duplicate .js in your jar dependencies
exclude duplicate .js inside your jar task
g
It seems to be some gradle plugin desynchronization. It works now without any modification in gradle scripts.
c
this is what I had to do to avoid it, to me the problem is deterministic:
eachFile { if(it.path.endsWith("kotlin.js") || it.path.endsWith("kotlinx-coroutines-core.js") || it.path.endsWith("kotlinx-html-js.js") || it.path.endsWith("kotlinx-serialization-runtime-js.js") || it.path.endsWith("kotlinx-atomicfu.js")) it.exclude() }
this inside the jar {} task
in my case it happens because I have the classic dependency structure core-->app, and I compile the kotlin dependencies already in the core, then in the app as well, hence it finds duplicates
so in the app I exclude the dependency
and don't forget: duplicatesStrategy = DuplicatesStrategy.EXCLUDE
inside jar {}