sbt

How to build a Scala project with Apache Ant alvin July 10, 2017 - 6:48pm

This is an excerpt from the Scala Cookbook (partially modified for the internet). This is Recipe 18.18, “Building a Scala Project with Apache Ant.”

Problem

You want to use Apache Ant to build your Scala project.

How to use a Maven repository library with SBT alvin July 10, 2017 - 6:34pm

This is an excerpt from the Scala Cookbook (partially modified for the internet). This is Recipe 18.17, “Using a Maven Repository Library with SBT.”

Problem

When working on a Scala project built with SBT, you want to use a Java library that’s in a Maven repository, but the library doesn’t include information about how to use it with Scala and SBT.

SBT: How to get started using the Build.scala file (instead of build.sbt) alvin July 10, 2017 - 4:49pm

This is an excerpt from the Scala Cookbook (partially modified for the internet). This is Recipe 18.16, “Using Build.scala Instead of build.sbt.”

Problem

In an SBT project, you want to use the project/Build.scala file instead of build.sbt to define your Scala project, or you need some examples of how to use Build.scala to solve build problems that can’t be handled in build.sbt.

How to “publish” a Scala/SBT library alvin July 10, 2017 - 4:38pm

20.15. Publishing Your Library

This is an excerpt from the Scala Cookbook (partially modified for the internet). This is Recipe 18.15, “Publishing an SBT Library.”

Problem

You’ve created a Scala project or library with SBT that you want to share with other users, creating all the files you need for an Ivy repository.

How to resolve SBT problems by generating a stack trace alvin July 10, 2017 - 4:28pm

This is an excerpt from the Scala Cookbook (partially modified for the internet). This is Recipe 18.12, “Resolving Problems by Getting an SBT Stack Trace.”

Problem

In a Scala project, you’re trying to use SBT to compile, run, or package a project, and it’s failing, and you need to be able to see the stack trace to understand why it’s failing.

How to configure SBT to find a repository (working with resolvers) alvin July 10, 2017 - 4:21pm

This is an excerpt from the Scala Cookbook (partially modified for the internet). This is Recipe 18.11, “Telling SBT How to Find a Repository (Working with Resolvers).”

Problem

In a Scala SBT project, you want to add a managed dependency to your project from an Ivy repository that SBT doesn’t know about by default.

Scala/SBT: How to specify a main method/class to run alvin July 10, 2017 - 4:11pm

This is an excerpt from the Scala Cookbook (partially modified for the internet). This is Recipe 18.9, “Specifying a Main Class to Run with SBT.”

Problem

In a Scala SBT project, you have multiple main methods in objects in your project, and you want to specify which main method should be run when you type sbt run, or specify the main method that should be invoked when your project is packaged as a JAR file.

Scala/SBT: How to generate project API documentation alvin July 10, 2017 - 4:00pm

This is an excerpt from the Scala Cookbook (partially modified for the internet). This is Recipe 18.8, “Generating SBT Project API Documentation.”

Problem

In an SBT project, you’ve marked up your Scala source code with Scaladoc comments, and want to generate the API documentation for your project.

Solution

Use any of the SBT commands listed in the following table, depending on your needs.

How to set the SBT logging level alvin July 10, 2017 - 2:52pm

This is an excerpt from the Scala Cookbook (partially modified for the internet). This is Recipe 18.13, “Setting the SBT Log Level.”

Problem

You’re having a problem compiling, running, or packaging your project with SBT, and need to adjust the SBT logging level to debug the problem. (Or, you’re interested in learning about how SBT works.)

Solution

Set the SBT logging level in your build.sbt file with this setting:

SBT: How to deploy a single, executable Jar file alvin July 10, 2017 - 2:40pm

This is an excerpt from the Scala Cookbook (partially modified for the internet). This is Recipe 18.14, “How to Deploy a Single, Executable JAR File.”

Problem

You’re building a Scala application, such as a Swing application, and want to deploy a single, executable JAR file to your users.