Every time I’ve needed to start a new Akka project, I’ve had to go through the process of scaffolding a new project from scratch. So I finally got around to creating a skeleton project that includes the bare minimum dependencies along with a build file, plugins and configuration required to create a fat jar as well as the ability to run in place. You can find the akka-skeleton project here.
To get going with akka-skeleton,
- Modify the
organization, name & version
inbuild.sbt
- Rename the package heirarchy under
src/main/scala
- Ensure you have atleast one class that
extends App
sbt run
Included Dependencies
- Akka Actor Module
- Akka Agent Module
- Google Guava
- Joda Time (and
joda-convert
to make it work correctly with Scala) - JUnit, ScalaTest and Akka TestKit
- Akka SLF4J Adapter
File Structure
The project root looks like this:
1 2 3 |
|
project
The project
folder contains all the files that help SBT build the project.
1 2 3 4 |
|
build.properties
describes the SBT version used to build the projectplugins.sbt
describes all the SBT plugins used to build the project – for example, theassembly
plugin is used to create a fat jar of the project including all the dependenciesDependencies.scala
describes all the project dependencies – objects from here are imported by thebuild.sbt
file when building the project
The src
folder contains the project source, test and resource files.
Build, Run and Assembly
sbt clean
to clean.
sbt compile
to build.
sbt run
to run.
sbt assembly
to create a fat jar.