Protected
Protected

Build and run Akka


Akka is using the excellent SBT build system. So the first thing you have to do is to download and install SBT. You can read more about how to do that here . SBT has good documentation which I encourage you to read if you want to fully take advantage of it, but for your convenience I have listed some of the most common commands below. We've also added a new command not in SBT to wrap up the distribution into a zip file which holds all Akka's JARs, dependencies and config files along with an executable JAR that will boot up the microkernel.

Fastest way to build and run Akka


If you only want to build the distribution and run the microkernel then the only thing you have to do is:

$ sbt update
$ sbt dist

This will download all Akka dependency JARs (sbt update), build and zip up the distribution (sbt dist). It will put all Akka's JARs in the ./dist directory together with the full distribution. This distribution is named 'akka_<scala-version>-<akka-version>.zip', e.g. for example 'akka_2.8.0.RC3-0.9.zip'. Now when you have the distribution you can just unzip this archive to wherever you want, set $AKKA_HOME environment variable to point to the root of the distribution and then boot it up by invoking 'java -jar akka_<scala-version>-<akka-version>.jar'. Here is an example:

$ unzip akka_2.8.0.RC3-0.9.zip
$ cd akka_2.8.0.RC3-0.9
$ export AKKA_HOME=`pwd`
$ java -jar akka_2.8.0.RC3-0.9.jar

Now the microkernel will boot up and install the sample applications that resides in the distribution's './deploy' directory. Here you can deploy your own applications.

There is also a script that you can use (copy and modify according to your needs) that resides in './scripts' directory and is called 'run_akka.sh'. So you can use it to run the microkernel like this:

$ ./scripts/run_akka.sh

See the section at the end of this page for more info on the startup script.

Use BivySack for packaging your application


"BivySack" For Akka - SBT plugin which creates a full akka microkernel deployment for your project.

Quick and dirty SBT Plugin for creating Akka Microkernel deployments of your SBT Project. This creates a proper "akka deploy" setup with all of your dependencies and configuration files loaded, with a bootable version of your project that you can run cleanly.

Read more about it here http://github.com/bwmcadams/sbt-akka-bivy.

Useful SBT commands


Here is a list with the most useful SBT commands

  • sbt - fire up SBT in interactive mode
  • sbt compile - compiles all the code
  • sbt cc - continuous compilation
  • sbt test - runs the scala tests
  • sbt clean - cleans the class files
  • sbt clean -cache' - cleans the dependency jars
  • sbt update - updates all dependency jars
  • sbt package - packages each module in a JAR
  • sbt dist - packages up the distribution into './dist'
  • sbt doc - generates the ScalaDoc
  • sbt console - starts up a REPL (interpreter) with all the Akka jars and dependencies on the classpath (very handy)

Read the SBT documentation for more commands.


Akka SBT Buildfile


The Akka buildfile resides in './project/build/AkkaProject.scala' with some properties in './project/build.properties'.


Publish artifacts to local Ivy repository


If you want to deploy the artifacts to your local Ivy repository then you can invoke:

$ sbt update
$ sbt publish-local
Note: you only need to "sbt update" if you want to update the dependencies (or the first time)


Publish artifacts to local Maven repository


If you want to deploy the artifacts to your local Maven repository then you can invoke:

$ sbt update
$ sbt publish-local
$ sbt publish

Startup script


This little script might help a bit. Just make sure you have the Akka distribution in the '$AKKA_HOME/dist' directory and then invoke this script to start up the kernel. The distribution is created in the './dist' dir for you if you invoke 'sbt dist'.

#!/bin/bash
cd $AKKA_HOME
VERSION=akka_2.8.0.RC3-0.9
TARGET_DIR=dist/$VERSION/$1
shift 1
[email protected]
 
if [ -d $TARGET_DIR  ]; then
    cd $TARGET_DIR
else
    unzip dist/${VERSION}.zip -d $TARGET_DIR
    cd $TARGET_DIR
fi
 
export AKKA_HOME=`pwd`
java -jar ${VMARGS} ${VERSION}.jar
Home
close
Loading...
Home Turn Off "Getting Started"
close
Loading...