播放2.4.x / java.lang.RuntimeException:冲突的跨版本后缀

时间:2017-02-13 16:57:35

标签: java playframework-2.0

运行我的sbt构建,我得到以下未解析的依赖项。

当我运行sbt update或sbt eclipse时会发生这种情况:

[error] (*:update) Conflicting cross-version suffixes in:
com.typesafe.play:play-functional, com.typesafe.akka:akka-actor,  com.typesafe.play:play-json
, com.typesafe.play:play, com.typesafe.play:play-iteratees, com.typesafe.play:twirl-api, com.typesafe.akka:akka-slf4j, org.scala-stm:scala-stm, com.ty
pesafe.play:play-datacommons
[error] Modules were resolved with conflicting cross-version suffixes in {file:/C:/test/}root:
[error]    com.typesafe.play:play-functional _2.11, _2.10
[error]    com.typesafe.akka:akka-actor _2.11, _2.10
[error]    com.typesafe.play:play-json _2.11, _2.10
[error]    com.typesafe.play:play _2.11, _2.10
[error]    com.typesafe.play:play-iteratees _2.11, _2.10
[error]    com.typesafe.play:twirl-api _2.11, _2.10
[error]    com.typesafe.akka:akka-slf4j _2.11, _2.10
[error]    org.scala-stm:scala-stm _2.11, _2.10
[error]    com.typesafe.play:play-datacommons _2.11, _2.10
java.lang.RuntimeException: Conflicting cross-version suffixes in: com.typesafe.play:play-functional, com.typesafe.akka:akka-actor, com.typesafe.play:
play-json, com.typesafe.play:play, com.typesafe.play:play-iteratees, com.typesafe.play:twirl-api, com.typesafe.akka:akka-slf4j, org.scala-stm:scala-st
m, com.typesafe.play:play-datacommons
        at scala.sys.package$.error(package.scala:27)
        at sbt.ConflictWarning$.processCrossVersioned(ConflictWarning.scala:46)
        at sbt.ConflictWarning$.apply(ConflictWarning.scala:32)
        at sbt.Classpaths$$anonfun$66.apply(Defaults.scala:1164)
        at sbt.Classpaths$$anonfun$66.apply(Defaults.scala:1161)
        at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
        at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:40)
        at sbt.std.Transform$$anon$4.work(System.scala:63)
        at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:226)
        at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:226)
        at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
        at sbt.Execute.work(Execute.scala:235)
        at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:226)
        at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:226)
        at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:159)
        at sbt.CompletionService$$anon$2.call(CompletionService.scala:28)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        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)

我的build.sbt包含以下内容:

name := "TestWeb"

scalaVersion := "2.11.6"

version := "1.0"

lazy val root = (project in file(".")).enablePlugins(PlayJava)

EclipseKeys.preTasks := Seq(compile in Compile)

EclipseKeys.projectFlavor := EclipseProjectFlavor.Java 
EclipseKeys.createSrc := EclipseCreateSrc.ValueSet(EclipseCreateSrc.ManagedClasses, EclipseCreateSrc.ManagedResources) 

libraryDependencies ++= Seq(
  "org.julienrf" % "play-jsmessages_2.10" % "2.0.0"
)

fork in run := true

我的项目/ plugins.sbt

resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"

addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.4.6")

addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "5.1.0")

并且sbt.version = 0.13.8

我无法添加JsMessages插件......

2 个答案:

答案 0 :(得分:1)

由于您使用的是Scala 2.11 ,因此您需要使用适当的依赖关系,而不是 2.10 。这一改变应该对你有帮助。

libraryDependencies += "org.julienrf" % "play-jsmessages_2.11" % "2.0.0"

答案 1 :(得分:0)

n中的2.10代表Scala 2.10。 Scala二进制兼容性问题(太多无法进入此处)意味着许多库具有Scala版本特定的依赖版本。 sbt试图告诉你,你有play-jsmessages_2.102.11个依赖关系。

如果您使用的是Scala 2.11.6,则需要与其兼容的2.10依赖项。