[英]Exception during macro expansion with sbt-native-packager and ScalaFXML
I have a small project on github that I created to explore ScalaFx and a few other things I want to use on a bigger project. 我在github上有一个小项目 ,我创建该项目是为了探索ScalaFx以及我想在更大的项目上使用的其他一些功能。 For now, it includes a single sub-project, which is a simple calculator written using ScalaFX and ScalaFXML.
目前,它只包含一个子项目,这是一个使用ScalaFX和ScalaFXML编写的简单计算器。
The project builds and runs fine using the SBT command calculator/run
. 使用SBT命令Calculator
calculator/run
可以构建并正常calculator/run
。
I'm now trying to package it using sbt-native-packager. 我现在正尝试使用sbt-native-packager对其进行打包。 I have added a simplistic project called "exemple-cli" (from sbt-native-packager's documentation), which packages fine with
exemple-cli/stage
(I get the expected result in exemple-cli/target/universal/stage). 我添加了一个名为“ exemple-cli”的简单项目(来自sbt-native-packager的文档),该项目可以用
exemple-cli/stage
进行打包(我在exemple-cli / target / universal / stage中得到了预期的结果)。 However, when I run the command calculator/stage
, I get the following error : 但是,当我运行命令
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
Apparently, there is an error with the macro used by ScalaFXML to generate proxy classes for controllers, but this only occurs when packaging with sbt-native-packager and not when just compiling with SBT... Does anyone have any idea what could cause this? 显然,ScalaFXML用来为控制器生成代理类的宏存在错误,但这仅在使用sbt-native-packager进行打包时发生,而不仅仅是在使用SBT进行编译时发生。 ?
Looks like SI-8771, which is a regression from 2.11.1 to 2.11.2. 看起来像SI-8771,它是从2.11.1到2.11.2的回归。 The workaround is to either downgrade to 2.11.2 or to change the code of the macro according to the details provided in comments to https://issues.scala-lang.org/browse/SI-8771 .
解决方法是降级到2.11.2或根据对https://issues.scala-lang.org/browse/SI-8771的注释中提供的详细信息更改宏的代码。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.