你们能告诉我如何在SBT项目中设置班级吗?我正在尝试使用0.13版。
我的目录结构非常简单(与SBT的文档不同)。在我具有build.sbt
以下内容的根文件夹中
name := "sbt_test"
version := "1.0"
scalaVersion := "2.10.1-local"
autoScalaLibrary := false
scalaHome := Some(file("/Program Files (x86)/scala/"))
mainClass := Some("Hi")
libraryDependencies ++= Seq(
"org.scalatest" % "scalatest_2.10" % "2.0.M5b" % "test"
)
EclipseKeys.withSource := true
而且我有project
单个文件的子文件夹,Hi.scala
其中包含以下代码
object Hi {
def main(args: Array[String]) = println("Hi!")
}
我可以通过调用来编译它,sbt compile
但是sbt run
返回
The system cannot find the file C:\work\externals\sbt\bin\sbtconfig.txt.
[info] Loading project definition from C:\work\test_projects\sbt_test\project
[info] Set current project to sbt_test (in build file:/C:/work/test_projects/sbt_test/)
java.lang.RuntimeException: No main class detected.
at scala.sys.package$.error(package.scala:27)
[trace] Stack trace suppressed: run last compile:run for the full output.
[error] (compile:run) No main class detected.
[error] Total time: 0 s, completed Apr 8, 2013 6:14:41 PM