Recently I started looking at some alternatives for increasing productivity when writing code and building systems in Scala. One option that is getting some attention is SBT – Simple Build Tool. In some ways, it is similar to Spring Roo. It generates some skeleton code (not sure how much though) and has an interactive shell that allows us to execute some tasks like compile and building, and even running in an application server if you are building an web application – which is what I was testing.
After some trouble installing, you can simply type sbt in a terminal to start the interactive shell. If the current directory doesn’t have an sbt project created, it will ask you to create one. Then, you can use commands like ~jetty-run to start your web application and make it run with jetty.
One thing I noticed is that it uses maven internally a lot (or seems to…) – at least for downloading dependencies and storing them in the local maven repository. But differently from maven, it copies the libraries used by the project to the project folder and use them from there. Also, although I’m not sure what this means exactly, sbt has several commands that have maven equivalents.
The web application I was trying was the Lift Chat Demo which you can find here: http://liftweb.net/getting_started. It is a pre-made sbt project; after downloading the sample, you execute sbt in the command line and can start playing (they have maven and other tool’s versions as well). When running this application with ~jetty-run changes made to the html files are detected on the fly. And so are the changes made to the Scala code. This is nice, but doable with maven as well.
This last statement leads to this post’s conclusion: sbt is a nice tool, but I’ll stick to maven for now, for one main reason: IDE support. Maven is greatly integrated with NetBeans (and Eclipse as well, I suppose), and I couldn’t find a nice way to use sbt with any IDE. Since I’m NOT a vi programmer, this leaves me with no option for now.
As a last note, please keep in mind that I only took a quick look at the most basic features of sbt – they probably have a whole lot more to offer. It just happens that I’m ok with the NetBeans + Maven combination for now.
And finally, a link that helped me clearing some ideas: http://php.jglobal.com/blog/?p=363
EDIT: Paul Phillips corrected me in an email in the Bay Area Scala Enthusiasts list about sbt using maven. Well, it doesn’t. It uses only the maven repositories, which is absolutely reasonable. Still, it certainly learned a lot with what maven does – again, very reasonable.
Pingback: sbt and maven « JCranky's Blog!