I am trying to use the Gatling Gradle plugin in a Spring Boot app. I am getting a bunch of errors like the following:
> Task :compileGatlingScala
java.io.IOException: Scala signature Predef has wrong version
expected: 5.0
found: 5.2 in Predef.class
In searching on Google, this error appears to be caused by having version 2.13
of Scala, instead of 2.12
. However, as far as I can see from the Gradle plugin in IntelliJ, I am using 2.12
.
Here are snippets from my build.gradle.kts
file:
plugins {
...
id("io.gatling.gradle") version "3.5.0"
}
dependencies {
...
gatling("org.scala-lang:scala-library") { version { strictly("2.12.10") } }
}
// The follow shows an error in the IDE, but it actually works to set the
// correct version in the Gradle `compileClasspath` and `runtimeClasspath`;
// without this, both of those get set to `2.13.4`
gatling {
scalaVersion = "2.12.10"
}
Here is the output of the gradle dependencies
command:
compileClasspath - Compile classpath for compilation 'main' (target (jvm)).
...
\--- org.scala-lang:scala-library:2.12.10
...
gatling
+--- org.scala-lang:scala-library:{strictly 2.12.10} -> 2.12.10
\--- io.gatling.highcharts:gatling-charts-highcharts:3.5.0
+--- org.scala-lang:scala-library:2.13.3 -> 2.12.10
+--- io.gatling:gatling-app:3.5.0
> +--- org.scala-lang:scala-library:2.13.3 -> 2.12.10
> +--- io.gatling:gatling-core:3.5.0
> > +--- org.scala-lang:scala-library:2.13.3 -> 2.12.10
> > +--- io.gatling:gatling-commons:3.5.0
> > > +--- org.scala-lang:scala-library:2.13.3 -> 2.12.10
> > > +--- io.gatling:gatling-commons-shared:3.5.0
> > > > +--- org.scala-lang:scala-library:2.13.3 -> 2.12.10
(and on and on)
...
gatlingCompileClasspath - Compile classpath for compilation 'gatling' (target (jvm)).
+--- org.scala-lang:scala-library:{strictly 2.12.10} -> 2.12.10
+--- io.gatling.highcharts:gatling-charts-highcharts:3.5.0
> +--- org.scala-lang:scala-library:2.13.3 -> 2.12.10
(and on and on)
...
gatlingImplementation - Implementation only dependencies for compilation 'gatling' (target (jvm)). (n)
+--- org.scala-lang:scala-library:2.12.10 (n)
+--- unspecified (n)
\--- unspecified (n)
gatlingImplementationDependenciesMetadata
+--- org.scala-lang:scala-library:{strictly 2.12.10} -> 2.12.10
+--- io.gatling.highcharts:gatling-charts-highcharts:3.5.0
> +--- org.scala-lang:scala-library:2.13.3 -> 2.12.10
(and on and on)
...
gatlingRuntimeClasspath - Runtime classpath of compilation 'gatling' (target (jvm)).
+--- org.scala-lang:scala-library:{strictly 2.12.10} -> 2.12.10
+--- io.gatling.highcharts:gatling-charts-highcharts:3.5.0
> +--- org.scala-lang:scala-library:2.13.3 -> 2.12.10
> +--- io.gatling:gatling-app:3.5.0
> > +--- org.scala-lang:scala-library:2.13.3 -> 2.12.10
(and on and on)
...
Everywhere that the scala-library
is showing up in the dependencies, the version is always being overridden to 2.12.10
. So I’m not sure where the bad version is coming from.
I have no idea what is wrong, or how to resolve the issue.