How to use playframework 2.3 with specs2 2.4 instead of specs2 2.3.x
Asked Answered
H

2

6

Recently, specs2 was updated to version 2.4, which uses scalaz 7.1 instead of 7.0.x now. Once I update my specs2 dependency in my play! 2.3 project to use version 2.4, all tests fail with the following exception:

 [error] Uncaught exception when running ...Spec: java.lang.In
 compatibleClassChangeError: Found class scalaz.syntax.FunctorOps, but interface
 was expected
 sbt.ForkMain$ForkError: Found class scalaz.syntax.FunctorOps, but interface was
 expected
    at org.specs2.specification.SpecificationStructure$.createSpecificationEither(BaseSpecification.scala:119)
    at org.specs2.runner.SbtRunner.org$specs2$runner$SbtRunner$$specificationRun(SbtRunner.scala:73)
    at org.specs2.runner.SbtRunner$$anonfun$newTask$1$$anon$5.execute(SbtRunner.scala:59)
    at sbt.ForkMain$Run$2.call(ForkMain.java:294)
    at sbt.ForkMain$Run$2.call(ForkMain.java:284)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

Nobody seems to have had this error before. At least I was unable to find it in the issue tracking systems of the specs2 and play project.

Haemostat answered 13/8, 2014 at 7:20 Comment(1)
Did you do a clean? Can you check that you really have scalaz 7.1 in your dependencies? (you can use the sbt dependency tree plugin for that)Overexcite
E
5

I make it working in Play 2.3.8 with this settings.

  "org.scalaz" %% "scalaz-core" % "7.1.1",
  "com.typesafe.play" %% "play-test" % "2.3.8" % "test" excludeAll(
     ExclusionRule(organization = "org.specs2")
   ),
  "org.specs2" %% "specs2-core" % "3.5" % "test",
  "org.specs2" %% "specs2-junit" % "3.5" % "test",
  "org.specs2" %% "specs2-mock" % "3.5" % "test"
Echinoid answered 19/5, 2015 at 22:51 Comment(1)
Not specifying "org.scalaz" %% "scalaz-core" % "7.1.1" works for me, too. That should be a transitive dependeny on the last three dependencies.Joelie
L
5

"com.typesafe.play" %% "play-test" % "2.3.3" depends on specs2 2.3.12, and specs2 2.3.12 depends on scalaz 7.0.6

You can/should not use these together. because scalaz 7.0.6 and 7.1.0 are binary incompatible.

if you want to use play2 and scalaz 7.1 together, I think there are some solutions

Leandra answered 25/8, 2014 at 21:50 Comment(1)
BTW I also published a version of specs2 2.4.2 for scalaz-7.0.6: look for specs2-scalaz-7.0.6 on Sonatype.Overexcite
E
5

I make it working in Play 2.3.8 with this settings.

  "org.scalaz" %% "scalaz-core" % "7.1.1",
  "com.typesafe.play" %% "play-test" % "2.3.8" % "test" excludeAll(
     ExclusionRule(organization = "org.specs2")
   ),
  "org.specs2" %% "specs2-core" % "3.5" % "test",
  "org.specs2" %% "specs2-junit" % "3.5" % "test",
  "org.specs2" %% "specs2-mock" % "3.5" % "test"
Echinoid answered 19/5, 2015 at 22:51 Comment(1)
Not specifying "org.scalaz" %% "scalaz-core" % "7.1.1" works for me, too. That should be a transitive dependeny on the last three dependencies.Joelie

© 2022 - 2024 — McMap. All rights reserved.