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 :
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 :
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.
3. then execute the following command.
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:
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:
We have a skeleton project with all dependencies and build scripts ready for an AKKA project.