I think you are on the right track with the idea and SBT. You tried
~compile
This will automatically detect changes in your source. For web applications you can do
jetty-run
followed by
~prepare-webapp
To constantly compile and relocate the application to the marina. Makes Scala dev very similar to Python web development.
I usually found that SBT compiles very quickly, especially the file size you are talking about. When I save the changes and move on to my SBT invitation, do this.
Another handy aspect of SBT is the REPL, which will load your project and its dependencies:
console
You can reload any compiled changes with
:replay
in Scala REPL.
EDIT: I think I should mention that you can play with a simple class using the main method. If you create a file called src / main / scala / Foo.scala that looks like this:
object Foo { def main(args: Array[String]) { println("Hello World") } }
And the file project / build / Build.scala:
import sbt._ class Build(info: ProjectInfo) extends DefaultProject(info) { override def mainClass = Some("Foo") }
Then at sbt prompt you can do
~run
To continuously compile and run the Foo.main method. You may need to reboot in sbt first. It seems that in 2-3 seconds from saving changes to getting the result. Then you simply edit, save and see the changes. This is a pretty good workflow.
Also, don't forget the REPL - definitely an important tool for learning Scala. You can find out a ton playing with it interactively.
Janx
source share