我創建了a small project on github來探索ScalaFx和其他一些我想用於更大項目的東西。目前,它包含一個單獨的子項目,這是一個使用ScalaFX和ScalaFXML編寫的簡單計算器。使用sbt-native-packager和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時...沒有人有任何想法可能會導致這種情況嗎?
我剛剛嘗試過Scala 2.11.1,它確實按預期工作 - 非常感謝!我想我會聯繫ScalaFXML作者,看看他是否知道這個問題。 – 2014-08-31 13:59:01