Problem Statement¶
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 compile
, run
, 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 .class
files.
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.
Solution¶
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 ~compile
in one console window - In other one, we run run
sbt console
.
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.
Just I minor correction, JRebel is free for personal _non-commercial_ use.