I have a Gradle Scala project where I'm trying to set up zinc 2.12. However, when I attempt to run the project using the command ./gradlew run
, I encounter a NoClassDefFoundError
related to scala/jdk/javaapi/CollectionConverters
or The version of 'scala-library' was changed while using the default Zinc version. Version 2.12.15 is not compatible with org.scala-sbt:zinc_2.13:1.6.1
error if I comment zinc out from dependencies.
Here's how my Gradle file looks like:
plugins {
id 'scala'
id 'application'
}
repositories {
mavenCentral()
}
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
if (details.requested.group == 'org.scala-lang') {
details.useVersion '2.12.15'
}
}
}
dependencies {
// zinc "org.scala-sbt:zinc_2.12:1.6.1"
implementation 'org.scala-lang:scala-library:2.12.15'
}
application {
mainClass = 'test.gradle.plugin.App'
}
I created a project to replicate this error, which can be found here.
I'm unsure how to resolve this issue. Any help would be greatly appreciated.