0

在 github上创建了一个小项目,用于探索 ScalaFx 以及我想在更大项目中使用的其他一些东西。目前,它包括一个子项目,这是一个使用 ScalaFX 和 ScalaFXML 编写的简单计算器。

该项目使用 SBT 命令构建并运行良好calculator/run

我现在正在尝试使用 sbt-native-packager 打包它。我添加了一个名为“exemple-cli”的简单项目(来自 sbt-native-packager 的文档),它可以很好地打包exemple-cli/stage(我在 exemple-cli/target/universal/stage 中得到了预期的结果)。但是,当我运行命令时calculator/stage,出现以下错误:

> calculator/stage
[info] Main Scala API documentation to /Users/guillaumegaly/IDEAWorkspace/scalafx-trials/calculator/target/scala-2.11/api...
[info] Packaging /Users/guillaumegaly/IDEAWorkspace/scalafx-trials/calculator/target/scala-2.11/calculator_2.11-0.0.1-SNAPSHOT.jar ...
[info] Wrote /Users/guillaumegaly/IDEAWorkspace/scalafx-trials/calculator/target/scala-2.11/calculator_2.11-0.0.1-SNAPSHOT.pom
[info] Done packaging.
Compiling ScalaFXML proxy class for CalculatorController
[error] /Users/guillaumegaly/IDEAWorkspace/scalafx-trials/calculator/src/main/scala/guilgaly/fxtest/calculator/CalculatorController.scala:13: exception during macro expansion: 
[error] java.lang.UnsupportedOperationException: Position.point on NoPosition
[error]     at scala.reflect.internal.util.Position.fail(Position.scala:17)
[error]     at scala.reflect.internal.util.UndefinedPosition.point(Position.scala:95)
[error]     at scala.reflect.internal.util.UndefinedPosition.point(Position.scala:90)
[error]     at scala.reflect.internal.Positions$class.wrappingPos(Positions.scala:42)
[error]     at scala.reflect.internal.SymbolTable.wrappingPos(SymbolTable.scala:16)
[error]     at scala.reflect.internal.Positions$class.wrappingPos(Positions.scala:37)
[error]     at scala.reflect.internal.SymbolTable.wrappingPos(SymbolTable.scala:16)
[error]     at scala.reflect.internal.TreeGen.mkTemplate(TreeGen.scala:378)
[error]     at scala.reflect.internal.ReificationSupport$ReificationSupportImpl$SyntacticClassDef$.apply(ReificationSupport.scala:341)
[error]     at scala.reflect.internal.ReificationSupport$ReificationSupportImpl$SyntacticClassDef$.apply(ReificationSupport.scala:326)
[error]     at scalafxml.core.macros.sfxmlMacro$.impl(sfxmlMacro.scala:162)
[error] @sfxml
[error]  ^
[info] No documentation generated with unsuccessful compiler run
[error] one error found
[error] (calculator/compile:doc) Scaladoc generation failed
[error] Total time: 1 s, completed 29 août 2014 21:39:04

显然,ScalaFXML 用于为控制器生成代理类的宏存在错误,但这仅在使用 sbt-native-packager 打包时发生,而不是仅在使用 SBT 编译时发生......有谁知道可能导致这种情况的原因?

4

1 回答 1

1

看起来像 SI-8771,这是从 2.11.1 到 2.11.2 的回归。解决方法是降级到 2.11.2 或根据对https://issues.scala-lang.org/browse/SI-8771的评论中提供的详细信息更改宏的代码。

于 2014-08-31T11:46:27.897 回答