我的scala程序正在使用scala.tools.nsc.interpreter.IMain中的编译器接口.当我使用scalac进行编译时,一切都按预期工作.但是当我用sbt编译它仍然编译时,但在执行时它会在从IMain实例调用explain-method时抛出以下错误消息:
Failed to initialize compiler: object scala not found.
** Note that as of 2.8 scala does not assume use of the java classpath.
** For the old behavior pass -usejavacp to scala, or if using a Settings
** object programatically, settings.usejavacp.value = true.
Run Code Online (Sandbox Code Playgroud)
如果我在IMain实例上使用settings.usejavacp.value = true,则会出现以下异常:
java.lang.Error: typeConstructor inapplicable for <none>
Run Code Online (Sandbox Code Playgroud)
我的SBT项目定义:
class Project(info: ProjectInfo) extends DefaultProject(info){
val scalaSwing = "org.scala-lang" % "scala-swing" % "2.9.0"
val scalaCompiler = "org.scala-lang" % "scala-compiler" % "2.9.0"
}
Run Code Online (Sandbox Code Playgroud)
这有什么不对?如何在Simple Build Tool Project中使用解释器?
我正在使用 …
我正在使用SimpleSwingApplicationscala swing中的特征构建一个GUI .我想要做的是提供一个关闭机制,询问用户(是,否,取消),如果他还没有保存文件.如果用户点击取消,Application则不应该关闭.但是,一切都我想到目前为止有MainFrame.close和closeOperation没有工作.
那么Scala Swing是如何完成的?
我在使用Scala 2.9.
提前致谢.
我想在我的Scala SBT项目中使用spring-data-neo4j 的高级映射模式(托管在github上):
我可以使用存储库将节点存储在数据库中,但我不能进行aspectj-weaving工作.
这是我到目前为止:
build.sbt:
resolvers ++= Seq(
"spring" at "http://repo.spring.io/milestone",
"neo4j-releases" at "http://m2.neo4j.org/releases/"
)
libraryDependencies ++= Seq(
"org.springframework.data" % "spring-data-neo4j" % "3.0.0.M1" % "compile",
"org.springframework.data" % "spring-data-neo4j-aspects" % "3.0.0.M1" % "compile",
"javax.persistence" % "persistence-api" % "1.0" % "compile",
"javax.validation" % "validation-api" % "1.0.0.GA" % "compile",
"junit" % "junit" % "4.11" % "test",
"com.novocode" % "junit-interface" % "0.9" % "test",
"org.springframework" % "spring-test" % "4.0.0.RELEASE" % "test"
)
Seq(aspectjSettings: _*)
verbose in Aspectj := false …Run Code Online (Sandbox Code Playgroud)