使用sbt-native-packager和ScalaFXML进行宏扩展时出现异常

时间:2014-08-29 20:03:59

标签: scala sbt scala-macros sbt-native-packager scalafx

我创建了a small project on 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进行编译时...有没有人知道是什么可能导致这个?

1 个答案:

答案 0 :(得分:1)

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