Play 2.3 got incompatible errors for DefaultReads

2019-06-03 17:58发布

问题:

I am trying to update play to 2.3 from 2.2, but I got several errors complaining about DefaultReads incompatible.

[error] Could not access term time in package java,
[error] because it (or its dependencies) are missing. Check your build definition for
[error] missing or conflicting dependencies. (Re-run with `-Ylog-classpath` to see the problematic classpath.)
[error] A full rebuild may help if 'DefaultReads.class' was compiled against an incompatible version of java.
[error]       (jsObj \ "items").asOpt[JsArray] match {

回答1:

The problem is play-cache dependency. I shouldn't use the latest one. After I use the one matched with Play version, it works.

"com.typesafe.play" % "play-cache_2.11" % "2.3.8"



回答2:

As suggested by @richard-close, the issue was caused in my case by having a jdk7 used by sbt.

You can check that with

sbt
> eval System.getProperty("java.version")
[info] ans: String = 1.7.0_80
> eval System.getProperty("java.home")
[info] ans: String = /usr/lib/jvm/java-7-oracle/jre