How to find good Scala libraries

This is an excerpt from the Scala Cookbook (partially modified for the internet). This is a short recipe, Recipe 14.7, “How to find good Scala libraries.”

Problem

Ruby has the RubyGems package manager, which lets developers easily distribute and manage the installation of Ruby libraries; does Scala have anything like this?

Solution

Prior to Scala 2.9.2, a tool named sbaz shipped with Scala, but it wasn’t very popular. Instead, most tools are “discovered” by paying attention to the mailing lists, using a search engine, and being aware of a few key websites.

As discussed in Chapter 18, once you’ve found a tool you want to use, you usually add it as a dependency to your project with SBT. For instance, to include libraries into your project, such as ScalaTest and Mockito, just add lines like this to your SBT build.sbt file:

resolvers += "Typesafe Repository" at "http://repo.typesafe.com/typesafe/releases/"

libraryDependencies ++= Seq(
    "org.scalatest" %% "scalatest" % "1.8" % "test",
    "org.mockito" % "mockito-core" % "1.9.0" % "test"
)

SBT has become the de facto tool for building Scala applications and managing dependencies. Possibly because of this success, a system like RubyGems hasn’t evolved, or been necessary.

Some of the top ways of finding Scala libraries are:

  • Searching for libraries using a search engine, or ls.implicit.ly
  • Asking questions and searching the scala-tools@googlegroups.com and scala-language@googlegroups.com mailing lists
  • New software is also announced at the “scala-announce” mailing list; you can find a list of Scala mailing lists online
  • Viewing tools listed at the Scala wiki
  • Scala project updates are often noted at notes.implicit.ly, the archive is at notes.implicit.ly/archive, and you can search for tools at ls.implicit.ly.
  • Asking questions on StackOverflow.com

The search engine at ls.implicit.ly is interesting. The owners advertise the site as “A card catalog for Scala libraries.” As they state on their website, they make two assumptions regarding their search process:

  • The library you’re looking for is an open source library that’s hosted at GitHub.
  • You build your projects with SBT.

For instance, if you search for “logging,” the website currently shows tools like the “Grizzled-SLF4J” library, but doesn’t show other logging projects that don’t meet their criteria.