Learn through the super-clean Baeldung Pro experience:
>> Membership and Baeldung Pro.
No ads, dark-mode and 6 months free of IntelliJ Idea Ultimate to start with.
Last updated: March 18, 2024
In this tutorial, we’ll see how we can create a new Scala sbt project using the Giter8 command line tool.
Giter8 is a command line tool that uses templates to generate a set of files and directories. This makes it a great tool for creating new projects with a standard structure.
Interestingly, Giter8 is also implemented in Scala.
Giter8 has an sbt integration. We can use it through the sbt new command:
$ sbt new scala/scala-seed.g8
This produces a new project with the following structure:
$ tree scala-seed-project/
scala-seed-project/
├── build.sbt
├── project
│ ├── Dependencies.scala
│ └── build.properties
└── src
├── main
│ └── scala
│ └── example
│ └── Hello.scala
└── test
└── scala
└── example
└── HelloSpec.scala
8 directories, 5 files
We can use the generated structure as a starting point for a new Scala project.
We used one of the many available project templates in the previous example. The Giter8 wiki contains a list of other templates that are available. There are templates for a number of different projects, including for the Play framework, Akka, and Spark.
Furthermore, we can create our own templates for our own projects.
In this article, we saw how to create a new Scala sbt project using an existing Giter8 template. The Giter8 command line tool lets us quickly bootstrap a new sbt project from scratch with the correct file structure.