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.
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:
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
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.
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
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.