$ mkdir demo $ cd demo $ mkdir -p src/{main,test}/{java,scala,resources}
Create a script hw.scala and place it under demo/src/scala
/*********** hw.scala ***************/ object Hi { def main(args: Array[String]) = println("Demo application says HELLO!") }
now run sbt -> Running sbt with no command line arguments starts it in interactive mode.
nxp10009@NXL01366 /c/workspaces/pelssers/demo $ sbt [info] Set current project to default-8388aa (in build file:/C:/workspaces/pelssers/demo/) > exit
We still have to create a build.sbt in the project root so let's do this first
name := "demo" version := "1.0-SNAPSHOT" scalaVersion := "2.9.2"
If we now rerun sbt again everything seems ok
$ sbt [info] Set current project to demo (in build file:/C:/workspaces/pelssers/demo/) > exit
You will now see sbt created a project folder for you. Here we will create a new build.properties file
nxp10009@NXL01366 /c/workspaces/pelssers/demo $ ls -la total 3 drwxr-xr-x 6 nxp10009 Administ 0 Dec 9 15:13 . drwxr-xr-x 8 nxp10009 Administ 4096 Dec 9 15:04 .. -rw-r--r-- 1 nxp10009 Administ 70 Dec 9 15:04 build.sbt drwxr-xr-x 3 nxp10009 Administ 0 Dec 9 15:13 project drwxr-xr-x 4 nxp10009 Administ 0 Dec 9 15:05 src drwxr-xr-x 3 nxp10009 Administ 0 Dec 9 15:12 target
$ cd project $ vi build.properties
sbt.version=0.12.0Enabling continous build and test
> ~ compile [success] Total time: 0 s, completed Dec 9, 2012 3:32:39 PM 1. Waiting for source changes... (press enter to interrupt) Now edit the hw.scala and make a little change: object Hi { def main(args: Array[String]) = println("Demo application says HELLO again!") } [info] Compiling 1 Scala source to C:\workspaces\pelssers\demo\target\scala-2.9.2\classes... [success] Total time: 1 s, completed Dec 9, 2012 3:33:02 PM 2. Waiting for source changes... (press enter to interrupt)
No comments:
Post a Comment