Create Akka project (2.2.3) with latest sbt (0.13) and scala (2.10.3)

In this blog, i will explain that how to create Akka project with the latest sbt and scala.

As we know, Now latest Akka version is 2.2.3, sbt is 0.13 and scala is 2.10.3

So lets start to create the project :
First of all, install the latest sbt and scala on your system then create sbt project by following the below steps :
First type sbt in an empty directory then type following commands :

> set name : "FirstAkkaProject"
> set version := "1.0"
> set scalaVersion := "2.10.3"
> session save
> exit

SBT creates files and directories when we executed the commands. It creates 2 folders : project & target and one file: build.sbt which contains the same values we typed in sbt session.

This is how build.sbt file looks like after executing sbt commands :

name := "FirstAkkaProject"

version := "1.0"

scalaVersion := "2.10.3"

Now, to make project importable in eclipse use the following steps :
1. Create a file named plugins.sbt inside project folder.
2. Add below line in this file.

addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.4.0") 

3. then execute the following command.

sbt eclipse 

It creates common source directories like src/main/scala, src/main/test, etc and also eclipse project files.

The project is ready to imported in Eclipse IDE. We also require Akka dependencies in our project. This can be done by adding resolvers and library dependencies to build.sbt at the top level. Add the following entries in build.sbt:

resolvers += "Typesafe Repository" at ""

libraryDependencies +=
"com.typesafe.akka" %% "akka-actor" % "2.2.3"

Whenever we add new dependencies we must execute “sbt eclipse” to regenerate the eclipse project configuration files. Now in order that code for Akka in our projects compiles correctly in Eclipse we execute the following command:

sbt eclipse 

We have a skeleton project with all dependencies and build scripts ready for an AKKA project.

About Rishi Khandelwal

Lead Consultant having more than 6 years industry experience. He has working experience in various technologies such as Scala, Java8, Play, Akka, Lagom, Spark, Hive, Kafka, Cassandra, Akka-http, Akka-Streams, ElasticSearch, Backbone.js, html5, javascript, Less, Amazon EC2, WebRTC, SBT
This entry was posted in Akka, Cloud, Scala, Web and tagged , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s