如何使用scalaz 7.2.0播放2.4.x.

时间:2016-01-08 14:12:00

标签: playframework scalaz specs2

由于specs2的版本,似乎存在一些问题。

编译测试时出现以下错误:

[error] Uncaught exception when running ServiceSpec: java.lang.IncompatibleClassChangeError: Found class scalaz.Memo, but interface was expected
[trace] Stack trace suppressed: run last test:test for the full output.
[error] Uncaught exception when running ApplicationSpec: java.lang.NoClassDefFoundError: Could not initialize class org.specs2.main.Arguments$
[trace] Stack trace suppressed: run last test:test for the full output.
[error] Uncaught exception when running IntegrationSpec: java.lang.NoClassDefFoundError: Could not initialize class org.specs2.main.Arguments$
[trace] Stack trace suppressed: run last test:test for the full output.
[error] Uncaught exception when running FileImportSpec: java.lang.NoClassDefFoundError: Could not initialize class org.specs2.main.Arguments$
[trace] Stack trace suppressed: run last test:test for the full output.

有解决方法吗?

3 个答案:

答案 0 :(得分:1)

TLDR;找不到工作区,所以我降级了它

问题不是Play而是specs2。我的specs2版本使用:scalaz-core版本7.1.1。您可以使用sbt dependency graph plugin找到自己的(插件似乎隐藏了测试范围的依赖项:从specs2依赖项中删除test范围)

我不得不将scalaz-core版本降级为7.1.1

  "org.scalaz" %% "scalaz-core" % "7.1.1"

干杯

答案 1 :(得分:0)

Yann,看看sbt Dependency overrides尝试强制使用scalaz版本。

即。我相信你在build.sbt中需要这样的东西(未经测试)

dependencyOverrides += "org.scalaz" %% "scalaz-core" % "7.2.0"

答案 2 :(得分:0)

我遇到了同样的问题,但对于Play 2.5.x.麻烦版本的scalaz和specs2为我解决了这个问题:

libraryDependencies ++= Seq(
  "org.scalaz" %% "scalaz-core" % "7.2.7",
  "org.specs2" %% "specs2-core" % "3.8.6" % "test"
)

也许有人会觉得有帮助;)