我有一个使用Intellij Idea scala sbt的项目设置。
sbtVersion = 1.2.8,scalaVersion = 2.13.0
我正在尝试设置加特林,但在运行命令后出现以下错误:
gatling: test
[错误]运行测试时未捕获的异常: java.lang.NoClassDefFoundError: scala / collection / mutable / ArrayOps $ ofRef [错误] sbt.ForkMain $ ForkError:java.lang.NoClassDefFoundError: scala / collection / mutable / ArrayOps $ ofRef [错误]位于 io.gatling.sbt.GatlingRunner.tasks(GatlingRunner.scala:31)[错误]在 sbt.ForkMain $ Run.runTests(ForkMain.java:258)[错误]在 sbt.ForkMain $ Run.run(ForkMain.java:144)[错误]在 sbt.ForkMain $ Run.access $ 100(ForkMain.java:140)在[错误] sbt.ForkMain.main(ForkMain.java:126)[错误]原因: sbt.ForkMain $ ForkError:java.lang.ClassNotFoundException: scala.collection.mutable.ArrayOps $ ofRef [错误]位于 java.net.URLClassLoader.findClass(URLClassLoader.java:381)[错误]在 java.lang.ClassLoader.loadClass(ClassLoader.java:424)在[错误] sun.misc.Launcher $ AppClassLoader.loadClass(Launcher.java:349)[错误] 在java.lang.ClassLoader.loadClass(ClassLoader.java:357)[错误]在 io.gatling.sbt.GatlingRunner.tasks(GatlingRunner.scala:31)[错误]在 sbt.ForkMain $ Run.runTests(ForkMain.java:258)[错误]在 sbt.ForkMain $ Run.run(ForkMain.java:144)[错误]在 sbt.ForkMain $ Run.access $ 100(ForkMain.java:140)在[错误] sbt.ForkMain.main(ForkMain.java:126)[info]模拟执行 结束了。 [错误]测试期间发生错误:[错误]分叉的测试工具 失败:java.io.EOFException [错误]在 java.io.ObjectInputStream $ BlockDataInputStream.peekByte(ObjectInputStream.java:2958) 在[错误] java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1538) 在[错误] java.io.ObjectInputStream.readObject(ObjectInputStream.java:431) sbt.React.react(ForkTests.scala:177)处的[错误] sbt.ForkTests $ Acceptor $ 2 $ .run(ForkTests.scala:108)在[错误] java.lang.Thread.run(Thread.java:748)[错误](加特林/测试) sbt.TestsFailedException:测试失败[错误]总时间:6 s, 已完成29-Aug-2019 09:53:58
build.sbt
enablePlugins(GatlingPlugin)
name := "performance-test"
version := "0.1"
scalaVersion := "2.13.0"
scalacOptions := Seq(
"-encoding", "UTF-8", "-target:jvm-1.8", "-deprecation",
"-feature", "-unchecked", "-language:implicitConversions", "-language:postfixOps")
libraryDependencies += "io.gatling.highcharts" % "gatling-charts-highcharts" % "3.2.1" % "test,it"
libraryDependencies += "io.gatling" % "gatling-test-framework" % "3.2.1" % "test,it"
plugins.sbt
addSbtPlugin("io.gatling" % "gatling-sbt" % "3.0.0")
BasicSimulation.scala
package idcheck
import io.gatling.core.Predef._
import io.gatling.http.Predef._
import scala.concurrent.duration._
class BasicSimulation extends Simulation {
val httpProtocol = http
.baseUrl("https://google.com")
val base = scenario("Test")
.exec(http("base endpoint")
.get("/"))
setUp(base.inject(atOnceUsers(1)).protocols(httpProtocol))
}
答案 0 :(得分:1)
是的,此错误随scala 2.13.x一起提供,降级至2.12.11:(