gpt4 book ai didi

scala - Sbt 0.13 插件依赖和 scala-reflect.jar 版本冲突

转载 作者:行者123 更新时间:2023-12-03 23:42:02 25 4
gpt4 key购买 nike

在为 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),则指令文件的构建会成功,但再次查看正在加载的 jars 我看到 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 构建的库。但我不确定这是否是正确的方法并会有所帮助。任何建议将不胜感激。

最佳答案

sbt 0.13.0 需要 Scala 2.10.2 或更高版本。该错误消息表明 2.10.2 中引入了一个缺失的类。因此,正如您所提到的,类路径似乎包含较旧的 Scala 版本。一般情况下,如果不设置scalaVersion ,正确版本的 Scala 应该包含在 sbt 插件的类路径中。

关于scala - Sbt 0.13 插件依赖和 scala-reflect.jar 版本冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19321180/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com