SBT - or why I stopped using Scala for more than a year

I would consider myself enthusiastic about Scala, even if I tend not to use most of the more sophisticated features but consider Scala as “Java, done right.”

However, there is one single pain point in the Scala eco-system that made me not only stop using Scala: SBT. And to be very blunt: The ‘U’ in SBT stands for usability.

But why am I writing all that? I want to know how you guys get along with this horrible piece of software. Where can I learn the basics about SBT best? The official documentation is convoluted, unstructured, and not newbie-friendly; books hardly exist as far as I saw.

I want to understand how SBT does things and how I can make it worthwhile for me.

You can use mill: Introduction to Mill :: Mill it’s much nicer. Great book that teaches it in a project-based way:


As a person that also works in maintaining pipelines of multiple projects and having used technologies like npm, yarn, maven, gradle, pip and make.

sbt is by far the simplest and easiest one to use of all of them.
(I do wonder how good cargo is based on what everyone says)

Sure, it has its rough corners and sometimes you have to apply some black magic spell found in the internet that nobody understands but \shrug

I do belive sbt could be improved but I also think it has done a lot over the years.
I am also pretty positive that for most common and basic usages it works as expected and has a smooth learning curve, check: sbt Reference Manual — sbt by example


For advanced build scenarios including publishing libraries and multi-project builds, sbt has worked fine for me, but now there is a really nice alternative for single-project builds:

Scala CLI has a great usability and developer experience already IMHO, even if it is still in 0.x so I think you should try it out :slight_smile:
There is also a proposal under review to make it the official new scala runner.
Initial discussions was started here Pre SIP: scala-cli as new scala command - #23 by romanowski - Tooling - Scala Contributors and the proposal is worked on here:
If you install Scala 3 from the official page using the recommended install method with cs setup you will get scala-cli on your path: Install | The Scala Programming Language

1 Like

Thank you for your reply; I am still using Scala 2 and have no short-term plans to switch to Scala 3. Does Scala CLI also work with Scala 2?

Yes you just scala-cli run . -S 2.13 or whatever Scala 2 version, for example you can nail it to 2.13.8 with -S 2.13.8. Or even better: you can add a magic comment in your code file.scala as this:

//> using scala "2.13.8"

and then just scala-cli run . and it will download and use the specified compiler version. Nice and simple :slight_smile:

See also Compile | Scala CLI and Directives | Scala CLI

You can install Scala CLI as a separate app on your path from here: Install Scala CLI | Scala CLI or e.g. via SDKMAN using; sdk install scalacli

1 Like
1 Like

seconding Luis’s recommendation, this is a great little crash course:


This post was flagged by the community and is temporarily hidden.

There’s absolutely nothing cryptic about Mill. And suggesting that SBT can’t be used in the real world is just ignorant, because it certainly is used in the real world all the time.

Plenty of people use Scala with Maven or Gradle. Most Scala developers don’t, because SBT and Mill are better in many ways. I’m sorry if you’d had to deal with a “dictator” boss but that’s not most people’s experience.

Some recent SBT material from Rock the JVM:


Rock The JVM is going to start putting out more sbt related videos. I asked him in the comments to make one for multi-module projects and he said that’ll be the subject of the next video :slight_smile:

Also, @dubaut I recommend checking out how some github projects write their build.sbt files to get a general idea of how things are done. Of course, avoid big projects by companies like Twitter as those can get very confusing.