问题
After making the following change to upgrade from play framework 2.3 to play 2.4:
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.4.3")
as well for the sbt version:
sbt.version=0.13.8
I got the following error:
trace] Stack trace suppressed: run last myProject-app-server/compile:playRoutes for the full output.
[error] (myProject-app-server/compile:playRoutes) java.lang.NoSuchMethodError: play.routes.compiler.inject.twirl.forwardsRouter_Scope0$forwardsRouter._display_(Ljava/lang/Object;Lscala/reflect/Manifest;)Lplay/twirl/api/Appendable;
as I understand from my research NoSuchMethodError is due to a version conflict, besides the compilation log displays warning of version conflict like so:
warn] Multiple dependencies with the same organization/name but different versions. To avoid conflict, pick one version:
[warn] * org.scala-lang:scala-compiler:(2.11.4, 2.11.11)
[warn] * org.scala-lang:scala-reflect:(2.11.4, 2.11.11)
[warn] * org.scala-lang.modules:scala-parser-combinators_2.11:(1.0.2, 1.0.4)
[warn] * org.scala-lang.modules:scala-xml_2.11:(1.0.2, 1.0.5)
so here is the sbt file:
ullResolvers := Seq(
projectResolver.value,
Resolver.defaultLocal,
"meta-maven" at "http://artifactory/artifactory/meta-maven",
Resolver.url("meta-ivy", url("http://artifactory/artifactory/meta-ivy"))(Resolver.ivyStylePatterns))
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.13.0")
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.4.3")
addSbtPlugin("com.typesafe.sbt" % "sbt-twirl" % "1.0.4")
addSbtPlugin("com.typesafe.sbt" % "sbt-coffeescript" % "1.0.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-less" % "1.0.4")
addSbtPlugin("com.typesafe.sbt" % "sbt-license-report" % "1.2.0")
as I see from the Jar files: the class forwardsRouter package play.routes.compiler.static.twirl does not contain the display method. I do not understand why play needs this method and could it be transferred to another package?
来源:https://stackoverflow.com/questions/56663300/error-after-upgrade-to-play-2-4-from-play2-3