Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the reason for java.lang.NoSuchMethodError: scala.Predef$.ArrowAssoc upon executing "sbt test"?

Tags:

scala

sbt

I have been running into the following error when I try to run sbt test with sbt 0.13.5 (and Java 1.7.0_45):

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

This is build.sbt I use:

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"
)

I have tried removing ~/.sbt and ~/.ivy2 directories, and was doing sbt clean after each.

This is the full stack trace:

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
like image 261
user1077071 Avatar asked Aug 01 '14 22:08

user1077071


1 Answers

I had the same error and noticed that sbt was actually compiling to scala 2.10 as a target. Changing scalaVersion to 2.11.4 resolved it.

like image 52
Renald Avatar answered Nov 18 '22 15:11

Renald