【问题标题】:SBT Build error with AKKA conflictAKKA 冲突的 SBT 构建错误
【发布时间】:2016-01-04 03:27:44
【问题描述】:

我所指的项目有以下build.sbt 文件:

name := "esc-index"

version := "1.0"

scalaVersion := "2.11.7"

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

libraryDependencies ++= {
  Seq(
  "com.typesafe.play" %% "play" % "2.3.10",
  "com.novocode" % "junit-interface" % "0.8" % "test"
  )
}

在执行 sbt compile 时,出现以下错误。

$ sbt compile
[info] Loading project definition from C:\Users\AnandKrishnan\Documents\GitHub\esc\index\project
[info] Set current project to esc-index (in build file:/C:/Users/AnandKrishnan/Documents/GitHub/esc/index/)
[info] Updating {file:/C:/Users/AnandKrishnan/Documents/GitHub/esc/index/}index...
[info] Resolving jline#jline;2.12.1 ...
[info] Done updating.
[error] Modules were resolved with conflicting cross-version suffixes in {file:/C:/Users/AnandKrishnan/Documents/GitHub/esc/index/}index:
[error]    com.typesafe.akka:akka-actor <none>, _2.11
java.lang.RuntimeException: Conflicting cross-version suffixes in: com.typesafe.akka:akka-actor
        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(Unknown Source)
        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
        at java.util.concurrent.FutureTask.run(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
[error] (*:update) Conflicting cross-version suffixes in: com.typesafe.akka:akka-actor
[error] Total time: 3 s, completed Jan 4, 2016 8:48:19 AM

我在sbt compile 之前做过sbt clean。我也尝试排除像这样.exclude("com.typesafe.akka", "akka-actor_2.11") 这样的akka​​,但没有运气。

【问题讨论】:

  • 能否请您从新目录尝试我在答案中发布的内容?
  • 你能列出目录的内容吗(使用tree或类似的)?您在项目中还有哪些其他文件?你可能有project 目录吗?里面是什么?您在主目录中还有哪些*.sbt 文件?

标签: scala sbt akka


【解决方案1】:

我刚刚尝试从新目录/tmp/aaa 成功:

$ cat > build.sbt
name := "esc-index"

version := "1.0"

scalaVersion := "2.11.7"

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

libraryDependencies ++= {
  Seq(
  "com.typesafe.play" %% "play" % "2.3.10",
  "com.novocode" % "junit-interface" % "0.8" % "test"
  )
}
$ sbt
[info] Loading global plugins from /Users/filippovitale/.sbt/0.13/plugins
[info] Updating {file:/Users/filippovitale/.sbt/0.13/plugins/}global-plugins...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
[info] Set current project to esc-index (in build file:/private/tmp/aaa/)
> compile
[info] Updating {file:/private/tmp/aaa/}aaa...
[info] Resolving jline#jline;2.12.1 ...
[info] downloading https://jcenter.bintray.com/com/typesafe/play/play_2.11/2.3.10/play_2.11-2.3.10.jar ...
[info]  [SUCCESSFUL ] com.typesafe.play#play_2.11;2.3.10!play_2.11.jar (5094ms)
[info] downloading https://jcenter.bintray.com/com/typesafe/play/build-link/2.3.10/build-link-2.3.10.jar ...
[info]  [SUCCESSFUL ] com.typesafe.play#build-link;2.3.10!build-link.jar (908ms)
[info] downloading https://jcenter.bintray.com/com/typesafe/play/play-iteratees_2.11/2.3.10/play-iteratees_2.11-2.3.10.jar ...
[info]  [SUCCESSFUL ] com.typesafe.play#play-iteratees_2.11;2.3.10!play-iteratees_2.11.jar (2011ms)
[info] downloading https://jcenter.bintray.com/com/typesafe/play/play-json_2.11/2.3.10/play-json_2.11-2.3.10.jar ...
[info]  [SUCCESSFUL ] com.typesafe.play#play-json_2.11;2.3.10!play-json_2.11.jar (1872ms)
[info] downloading https://jcenter.bintray.com/io/netty/netty/3.9.9.Final/netty-3.9.9.Final.jar ...
[info]  [SUCCESSFUL ] io.netty#netty;3.9.9.Final!netty.jar(bundle) (2119ms)
[info] downloading https://jcenter.bintray.com/com/typesafe/play/play-exceptions/2.3.10/play-exceptions-2.3.10.jar ...
[info]  [SUCCESSFUL ] com.typesafe.play#play-exceptions;2.3.10!play-exceptions.jar (842ms)
[info] downloading https://jcenter.bintray.com/com/typesafe/play/play-functional_2.11/2.3.10/play-functional_2.11-2.3.10.jar ...
[info]  [SUCCESSFUL ] com.typesafe.play#play-functional_2.11;2.3.10!play-functional_2.11.jar (1927ms)
[info] downloading https://jcenter.bintray.com/com/typesafe/play/play-datacommons_2.11/2.3.10/play-datacommons_2.11-2.3.10.jar ...
[info]  [SUCCESSFUL ] com.typesafe.play#play-datacommons_2.11;2.3.10!play-datacommons_2.11.jar (850ms)
[info] downloading https://jcenter.bintray.com/com/novocode/junit-interface/0.8/junit-interface-0.8.jar ...
[info]  [SUCCESSFUL ] com.novocode#junit-interface;0.8!junit-interface.jar (1066ms)
[info] downloading https://jcenter.bintray.com/junit/junit/4.8.2/junit-4.8.2.jar ...
[info]  [SUCCESSFUL ] junit#junit;4.8.2!junit.jar (1795ms)
[info] Done updating.
[success] Total time: 33 s, completed 04/01/2016 2:31:04 PM

【讨论】:

  • 谢谢 Filippo,您的意思是将整个项目复制到另一个文件夹并重试吗?
  • 我的意思是空目录中的build.sbt 文件,然后尝试sbt compile
  • 问题是由于 Scala 和 Play 的版本冲突。 SBT 依赖项和实际代码中的那个不匹配,因为代码是很久以前写的,并且依赖项只更新到了最新版本。
  • 我可以通过将 java 版本指定为 java 7 而不是 8 来使其工作,这迫使我将所有依赖项更改为导致上述错误的新依赖项。 sbt -java-home /c/"程序文件"/Java/jdk1.7.0_79
猜你喜欢
  • 2012-01-20
  • 2023-03-16
  • 2018-06-22
  • 2019-03-23
  • 2013-05-18
  • 1970-01-01
  • 2011-03-18
  • 2018-02-06
  • 1970-01-01
相关资源
最近更新 更多