web-dev-qa-db-fra.com

Quelle est la raison de Java.lang.NoSuchMethodError: scala.Predef $ .ArrowAssoc lors de l'exécution de "sbt test"?

J'ai rencontré l'erreur suivante lorsque j'essaie d'exécuter sbt test avec sbt 0.13.5 (et Java 1.7.0_45):

[erreur] (test: executeTests) Java.lang.NoSuchMethodError: scala.Predef $ .ArrowAssoc (Ljava/lang/Object;) Ljava/lang/Object;

Ceci est build.sbt j'utilise:

version := "0.1"

scalaVersion := "2.10.3"

resolvers ++= Seq(
  "spray" at "http://repo.spray.io",
  "Typesafe Repository" at "http://repo.typesafe.com/typesafe/releases/"
)

libraryDependencies ++= Seq(
  "io.spray" %% "spray-json" % "1.2.5",
  "com.typesafe.akka" %% "akka-actor" % "2.2.4",
  "com.typesafe.akka" %% "akka-slf4j" % "2.2.4",
  "com.typesafe.akka" %% "akka-testkit" % "2.2.4",
  "com.github.kxbmap" %% "configs" % "0.2.1",
  "junit" % "junit" % "4.8.1" % "test",
  "ch.qos.logback" % "logback-classic" % "1.0.13",
  "io.spray" % "spray-can" % "1.2.1",
  "io.spray" % "spray-routing" % "1.2.1",
  "io.spray" % "spray-testkit" % "1.2.1",
  "org.scalatest" % "scalatest_2.10" % "2.0" % "test",
  "com.typesafe.akka" %% "akka-testkit" % "2.1.4"% "test",
  "org.mockito" % "mockito-core" % "1.9.5",
  "org.specs2" %% "specs2" % "2.1.1" % "test"
)

J'ai essayé de supprimer les répertoires ~/.sbt et ~/.ivy2 et je faisais sbt clean après chaque.

C'est la trace de pile complète:

sbt test
[info] Loading project definition from /Users/arumehta/cds_torii/project
[info] Set current project to cds_torii (in build file:/Users/arumehta/cds_torii/)
Java.lang.NoSuchMethodError: scala.Predef$.ArrowAssoc(Ljava/lang/Object;)Ljava/lang/Object;
    at org.scalatest.tools.FriendlyParamsTranslator$.<init>(FriendlyParamsTranslator.scala:23)
    at org.scalatest.tools.FriendlyParamsTranslator$.<clinit>(FriendlyParamsTranslator.scala)
    at org.scalatest.tools.Framework.runner(Framework.scala:1064)
    at sbt.Defaults$$anonfun$createTestRunners$1.apply(Defaults.scala:515)
    at sbt.Defaults$$anonfun$createTestRunners$1.apply(Defaults.scala:510)
    at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
    at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
    at scala.collection.immutable.Map$Map2.foreach(Map.scala:130)
    at scala.collection.TraversableLike$class.map(TraversableLike.scala:244)
    at scala.collection.AbstractTraversable.map(Traversable.scala:105)
    at sbt.Defaults$.createTestRunners(Defaults.scala:510)
    at sbt.Defaults$.allTestGroupsTask(Defaults.scala:525)
    at sbt.Defaults$$anonfun$testTasks$4.apply(Defaults.scala:392)
    at sbt.Defaults$$anonfun$testTasks$4.apply(Defaults.scala:392)
    at scala.Function8$$anonfun$tupled$1.apply(Function8.scala:35)
    at scala.Function8$$anonfun$tupled$1.apply(Function8.scala:34)
    at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
    at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:42)
    at sbt.std.Transform$$anon$4.work(System.scala:64)
    at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)
    at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)
    at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18)
    at sbt.Execute.work(Execute.scala:244)
    at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237)
    at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237)
    at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:160)
    at sbt.CompletionService$$anon$2.call(CompletionService.scala:30)
    at Java.util.concurrent.FutureTask.run(FutureTask.Java:262)
    at Java.util.concurrent.Executors$RunnableAdapter.call(Executors.Java:471)
    at Java.util.concurrent.FutureTask.run(FutureTask.Java:262)
    at Java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.Java:1145)
    at Java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.Java:615)
    at Java.lang.Thread.run(Thread.Java:744)
[error] (test:executeTests) Java.lang.NoSuchMethodError: scala.Predef$.ArrowAssoc(Ljava/lang/Object;)Ljava/lang/Object;
[error] Total time: 1 s, completed Aug 1, 2014 3:49:24 PM
13
user1077071

J'ai eu la même erreur et j'ai remarqué que sbt compilait scala 2.10 comme cible. Changer scalaVersion en 2.11.4 l'a résolu.

9
Renald

Effectuer ci-dessous à partir du dossier du projet,

  1. sbt propre 
  2. test de sbt

Cela fonctionnera comme un charme ...

1
R.G.Karthic Balaji