无法扩展以前版本的Scala编译的宏(scala 2.11.4,sbt 0.13.7,JDK 8)

时间:2015-01-11 14:32:18

标签: java scala sbt

我正在将项目转换为Scala 2.11.4和sbt 0.13.7。我遇到了很多错误,其中一些是:

can't expand macros compiled by previous versions of Scala
[error]     preloadDevice <<= preloadDeviceTask

代码:

lazy val settings: Seq[Setting[_]] = inConfig(Android) (Seq(
    // Preload Scala on the device/emulator
    preloadDevice <<= preloadDeviceTask,
    preloadEmulator <<= InputTask(
      (sdkPath)(AndroidProject.installedAvds(_)))(preloadEmulatorTask),

    // Uninstall previously preloaded Scala
    unloadDevice <<= unloadDeviceTask,
    unloadEmulator <<= InputTask(
      (sdkPath)(AndroidProject.installedAvds(_)))(unloadEmulatorTask)
  ))

我该如何解决?

更新

JDK 8

1 个答案:

答案 0 :(得分:3)

从这里开始:Why doesn't the Def.inputTask macro work in Scala 2.11.1?

  

在build.sbt文件中,请确保scalaVersion:=&#34; 2.10.4&#34;代替   像scalaVersion:=&#34; 2.11.x&#34;

如果您使用JDK 8,则对Scala 2.10.x编译的Sbt 0.13.x没有太多选项:

  • 仅对sbt使用JDK7(通过在运行脚本中为sbt设置特定的JAVA_HOME) - 您的项目仍将针对JDK8进行编译
  • 尝试JDK8 + Scala-2.10 for sbt(它可能有效,但当然不能保证)
  • 针对JDK8构建sbt 0.13 by yourself