【发布时间】:2013-10-19 17:07:06
【问题描述】:
在为 sbt 0.13 构建插件时,构建任何(插件的)库依赖项的 scala 2.10 版本是否重要?
目前我的插件依赖于针对 scala 2.10.2 构建的库。这适用于单个构建,但是当构建 (A) 依赖于另一个构建 (B) 时,通过 ProjectRef,我发现项目 B 中构建指令的 sbt 编译失败。似乎 sbt 正在使用 2.10.2 来构建指令文件,但是正在加载 scala-reflect-2.10.0.jar(来自 sbt 调试回溯,在将 Calling Scala compiler with arguments (CompilerInterface) 打印到屏幕之后)。
如果我自己构建引用的项目 (B),指令文件的构建会成功,但再次查看正在加载的 jar,我发现 scala-2.10.2/lib/scala-reflect.jar 被引用了。
失败的错误信息是:
[error] error while loading MacroValue, Missing dependency 'bad symbolic reference. A signature in MacroValue.class refers to term annotations
[error] in package scala.reflect.internal which is not available.
[error] It may be completely missing from the current classpath, or the version on
[error] the classpath might be incompatible with the version used when compiling MacroValue.class.', required by /home/alex.wilson/.ivy2/cache/org.scala-sbt/main-settings/jars/main-settings-0.13.0.jar(sbt/std/MacroValue.class)
[error] error while loading InputEvaluated, Missing dependency 'bad symbolic reference. A signature in InputEvaluated.class refers to term annotations
[error] in package scala.reflect.internal which is not available.
[error] It may be completely missing from the current classpath, or the version on
[error] the classpath might be incompatible with the version used when compiling InputEvaluated.class.', required by /home/alex.wilson/.ivy2/cache/org.scala-sbt/main-settings/jars/main-settings-0.13.0.jar(sbt/std/InputEvaluated.class)
[error] error while loading ParserInput, Missing dependency 'bad symbolic reference. A signature in ParserInput.class refers to term annotations
[error] in package scala.reflect.internal which is not available.
[error] It may be completely missing from the current classpath, or the version on
[error] the classpath might be incompatible with the version used when compiling ParserInput.class.', required by /home/alex.wilson/.ivy2/cache/org.scala-sbt/main-settings/jars/main-settings-0.13.0.jar(sbt/std/ParserInput.class)
[error] three errors found
如果需要,我可以重建我的插件,使其依赖于针对 2.10.0 构建的库。但我不确定这是否是正确的方法并会有所帮助。任何建议将不胜感激。
【问题讨论】:
-
你在交叉编译吗?比如反对 2.9?
-
我没有交叉编译。在这种情况下,插件是让 sbt 构建原生 c++ 项目,本质上使用 sbt 作为构建工具构建工具包,然后编写 gcc、clang 等脚本 (github.com/d40cht/sbt-cpp)
-
@MatthewFarwell 至少我认为我没有交叉编译。你的意思是在 sbt 指令的构建时,还是在插件依赖的库中,或者使用 sbt 和插件来交叉编译 scala?