title: gatling on gradle: NoClassDefFoundError: scala/Serializable
body: <p>Following a couple of online tutorials, I am trying to include some load testing in my gradle build. I am getting this error when executing gradle loadTest. I use Java 12 (sourceCompatibility 11 configured in build.gradle)</p>
  
  <p>Relevant plugins:</p>
  
  <pre><code>apply plugin: "scala"
  implementation('org.scala-lang:scala-library:2.13.0')
  testCompile("io.gatling.highcharts:gatling-charts-highcharts:3.2.1")
  </code></pre>
  
  <p>gradle task:</p>
  
  <pre><code>task loadTest(type: JavaExec) {
    dependsOn testClasses
    description = "load test with Gatling"
    group = "Load Test"
    classpath = sourceSets.test.runtimeClasspath
    main = "io.gatling.app.Gatling"
    args = [
            "--simulation", "com.skios.ms.authentication.test.MainSimulation",
            "--results-folder", "${buildDir}/gatling-results",
            "--bodies-folder", sourceSets.test.resources.srcDirs.toList().first().toString() + "/gatling/bodies",
    ]
  }
  </code></pre>
  
  <p>Test class:</p>
  
  <pre><code>package com.skios.ms.authentication.test
  
  import scala.language.postfixOps
  import io.gatling.core.Predef._
  import io.gatling.http.Predef._
  
  import scala.concurrent.duration._
  
  class MainSimulation extends Simulation {
  
    val httpConf = http.baseUrl("https://MYAPI.COM/api/v1") 
    val scn = scenario("Sample")
      .exec(http("request1")
        .get("/authentication/get-token"))
      .pause(100)
    setUp(scn.inject(rampUsers(20) during (5 seconds)).protocols(httpConf))
  }
  </code></pre>
  
  <p>gradle result:</p>
  
  <pre><code>Starting a Gradle Daemon (subsequent builds will be faster)
  
  &gt; Task :compileTestScala
  
  Pruning sources from previous analysis, due to incompatible CompileSetup.
  
  &gt; Task :loadTest FAILED
  Exception in thread "main" java.lang.NoClassDefFoundError: scala/Serializable
          at java.base/java.lang.ClassLoader.defineClass1(Native Method)
          at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1016)
          at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:151)
          at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:802)
          at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:700)
          at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:623)
          at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
          at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
          at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
          at com.typesafe.scalalogging.StrictLogging.$init$(Logging.scala:39)
          at io.gatling.app.Gatling$.&lt;init&gt;(Gatling.scala:35)
          at io.gatling.app.Gatling$.&lt;clinit&gt;(Gatling.scala)
          at io.gatling.app.Gatling.main(Gatling.scala)
  Caused by: java.lang.ClassNotFoundException: scala.Serializable
          at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
          at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
          at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
          ... 13 more
  
  FAILURE: Build failed with an exception.
  
  * What went wrong:
  Execution failed for task ':loadTest'.
  &gt; Process 'command '/Library/Java/JavaVirtualMachines/jdk-12.0.1.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1
  
  * Try:
  Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
  
  * Get more help at https://help.gradle.org
  
  BUILD FAILED in 21s
  5 actionable tasks: 5 executed
  </code></pre>
  
  <p>I have no Scala experience so I'm pretty lost. Any ideas? Thanks.</p>