Scala REPL is a great tool for incrementally develop software. However, its is quite slow as noted here. Alternative: use Simple Build Tool, aka– SBT. SBT, via its tasks such as
console, facilitates a quick feedback cycle. The command
sbt ~compile further provides continuous/incremental compilation model, that is– whenever a
.scala file changes, it re-compiles them and generates
Problem is that in order to reload these changed class files, one has to restart sbt
console. In my humble opinion, it seems a bit inconvenient.
JRebel provides dynamic reloading of modified *.class files. In combination with
sbt ~compile, this setup leads to an interactive development experience as follows.
- We run
sbt ~compilein one console window
- In other one, we run run
Thus, when we modify Scala source codes, first SBT instance compiles it and generates class files. If we invoke any command in the second SBT instance, JRebel reloads the modified class files and afterwards the command gets executed, as shown below.
Note that JRebel is free for personal use, and it is definitely worth taking a look. For more information about the development flow using JRebel, SBT, Eclipse/IDEA, please have a look at this article which describes the setup process in details, or simply leave a comment.