无法添加自定义SBT操作
我刚刚开始使用SBT。 要添加自定义操作,我做了以下任务,并将该.scala文件添加为SBT wiki指南中的“项目”文件夹。
//MyProject.scala
import sbt._
class HelloWorldProject(info: ProjectInfo) extends DefaultProject(info)
{
lazy val hi = task { println("Hello World"); None }
}
在添加scala src文件进行配置后,项目文件夹的布局看起来像这样。
/development/scala/SomeScalaProject/ |~lib/ |~project/ | |~boot/ | | |~scala-2.7.7/ | | | |~lib/ | | | | |-scala-compiler.jar [RO] | | | | `-scala-library.jar [RO] | | | `~org.scala-tools.sbt/ | | | `~sbt/ | | | `+0.7.4/ | | |~scala-2.8.1/ | | | `~lib/ | | | |-scala-compiler.jar [RO] | | | `-scala-library.jar [RO] | | `-sbt.boot.lock | |-build.properties | | | `-MyProject.scala //here | |+src/
但即使在“重新加载”或“更新”后,在SBT中运行hi任务根本不可用。 我错过了什么?
D:developmentscalaSBEStudy>java -Xmx512M -jar "D:development.commonsbt-la nch-0.7.4.jar" update [info] Building project SomeScalaProject 1.0 against Scala 2.8.1 [info] using sbt.DefaultProject with sbt 0.7.4 and Scala 2.7.7 [info] [info] == update == [warn] No dependency configuration found, using defaults. [info] :: retrieving :: nephilim.practice#scalabyexample_2.8.1 [sync] [info] confs: [default] [info] 0 artifacts copied, 0 already retrieved (0kB/391ms) [info] == update == [success] Successful. [info] [info] Total time: 1 s, completed 2010. 12. 8 오후 7:14:39 [info] [info] Total session time: 2 s, completed 2010. 12. 8 오후 7:14:39 [success] Build completed successfully.
> reload [info] Building project SomeScalaProject 1.0 against Scala 2.8.1 [info] using sbt.DefaultProject with sbt 0.7.4 and Scala 2.7.7 > hi [error] No action named 'hi' exists. [info] Execute 'help' for a list of commands or 'actions' for a list of availab e project actions and methods.
这是我的错误。 :(
“MyProject.scala”应位于/ project / build目录下而不是/ project目录下。
上一篇: can't add custom SBT action
下一篇: CSS Font Border?