diff --git a/akka-docs/modules/microkernel.rst b/akka-docs/modules/microkernel.rst
index 7325cefa70..ec6eabe3ef 100644
--- a/akka-docs/modules/microkernel.rst
+++ b/akka-docs/modules/microkernel.rst
@@ -24,7 +24,7 @@ command (on a unix-based system):
.. code-block:: none
- bin/akka sample.kernel.hello.HelloKernel
+ bin/start sample.kernel.hello.HelloKernel
Use ``Ctrl-C`` to interrupt and exit the microkernel.
@@ -34,3 +34,34 @@ The code for the Hello Kernel example (see the ``HelloKernel`` class for an exam
of creating a Bootable):
.. includecode:: ../../akka-samples/akka-sample-hello-kernel/src/main/scala/sample/kernel/hello/HelloKernel.scala
+
+
+Distribution of microkernel application
+---------------------------------------
+
+To make a distribution package of the microkernel and your application the ``akka-sbt-plugin`` provides
+``AkkaKernelPlugin``. It creates the directory structure, with jar files, configuration files and
+start scripts.
+
+To use the sbt plugin you define it in your ``project/plugins.sbt``:
+
+.. includecode:: ../../akka-sbt-plugin/sample/project/plugins.sbt
+
+Then you add it to the settings of your ``project/Build.scala``. It is also important that you add the ``akka-kernel`` dependency.
+This is an example of a complete sbt build file:
+
+.. includecode:: ../../akka-sbt-plugin/sample/project/Build.scala
+
+Run the plugin with sbt::
+
+ > dist
+ > dist:clean
+
+There are several settings that can be defined:
+
+* ``outputDirectory`` - destination directory of the package, default ``target/dist``
+* ``distJvmOptions`` - JVM parameters to be used in the start script
+* ``configSourceDirs`` - Configuration files are copied from these directories, default ``src/config``, ``src/main/config``, ``src/main/resources``
+* ``distMainClass`` - Kernel main class to use in start script
+* ``libFilter`` - Filter of dependency jar files
+* ``additionalLibs`` - Additional dependency jar files
diff --git a/akka-sbt-plugin/sample/project/Build.scala b/akka-sbt-plugin/sample/project/Build.scala
new file mode 100644
index 0000000000..0fc391775b
--- /dev/null
+++ b/akka-sbt-plugin/sample/project/Build.scala
@@ -0,0 +1,58 @@
+
+import sbt._
+import Keys._
+import akka.sbt.AkkaKernelPlugin
+import akka.sbt.AkkaKernelPlugin.{ Dist, outputDirectory, distJvmOptions}
+
+object HelloKernelBuild extends Build {
+ val Organization = "akka.sample"
+ val Version = "2.0-SNAPSHOT"
+ val ScalaVersion = "2.9.1"
+
+ lazy val HelloKernel = Project(
+ id = "hello-kernel",
+ base = file("."),
+ settings = defaultSettings ++ AkkaKernelPlugin.distSettings ++ Seq(
+ libraryDependencies ++= Dependencies.helloKernel,
+ distJvmOptions in Dist := "-Xms256M -Xmx1024M",
+ outputDirectory in Dist := file("target/hello-dist")
+ )
+ )
+
+ lazy val buildSettings = Defaults.defaultSettings ++ Seq(
+ organization := Organization,
+ version := Version,
+ scalaVersion := ScalaVersion,
+ crossPaths := false,
+ organizationName := "Typesafe Inc.",
+ organizationHomepage := Some(url("http://www.typesafe.com"))
+ )
+
+ lazy val defaultSettings = buildSettings ++ Seq(
+ resolvers += "Typesafe Repo" at "http://repo.typesafe.com/typesafe/releases/",
+
+ // compile options
+ scalacOptions ++= Seq("-encoding", "UTF-8", "-deprecation", "-unchecked"),
+ javacOptions ++= Seq("-Xlint:unchecked", "-Xlint:deprecation")
+
+ )
+}
+
+object Dependencies {
+ import Dependency._
+
+ val helloKernel = Seq(
+ akkaKernel, akkaSlf4j, logback
+ )
+}
+
+object Dependency {
+ // Versions
+ object V {
+ val Akka = "2.0-M3"
+ }
+
+ val akkaKernel = "com.typesafe.akka" % "akka-kernel" % V.Akka
+ val akkaSlf4j = "com.typesafe.akka" % "akka-slf4j" % V.Akka
+ val logback = "ch.qos.logback" % "logback-classic" % "1.0.0"
+}
diff --git a/akka-sbt-plugin/sample/project/build.properties b/akka-sbt-plugin/sample/project/build.properties
new file mode 100644
index 0000000000..f4ff7a5afa
--- /dev/null
+++ b/akka-sbt-plugin/sample/project/build.properties
@@ -0,0 +1 @@
+sbt.version=0.11.2
diff --git a/akka-sbt-plugin/sample/project/plugins.sbt b/akka-sbt-plugin/sample/project/plugins.sbt
new file mode 100644
index 0000000000..afba4f3ad2
--- /dev/null
+++ b/akka-sbt-plugin/sample/project/plugins.sbt
@@ -0,0 +1,3 @@
+resolvers += "Typesafe Repo" at "http://repo.typesafe.com/typesafe/releases/"
+
+addSbtPlugin("com.typesafe.akka" % "akka-sbt-plugin" % "2.0-M3")
diff --git a/akka-sbt-plugin/sample/src/main/config/application.conf b/akka-sbt-plugin/sample/src/main/config/application.conf
new file mode 100644
index 0000000000..e8271a1081
--- /dev/null
+++ b/akka-sbt-plugin/sample/src/main/config/application.conf
@@ -0,0 +1,4 @@
+akka {
+ loglevel = INFO
+ event-handlers = ["akka.event.slf4j.Slf4jEventHandler"]
+}
\ No newline at end of file
diff --git a/akka-sbt-plugin/sample/src/main/config/logback.xml b/akka-sbt-plugin/sample/src/main/config/logback.xml
new file mode 100644
index 0000000000..bddac0313d
--- /dev/null
+++ b/akka-sbt-plugin/sample/src/main/config/logback.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+ %date{ISO8601} %-5level %X{akkaSource} %X{sourceThread} - %msg%n
+
+
+
+
+
+
+
+
diff --git a/akka-sbt-plugin/sample/src/main/scala/HelloKernel.scala b/akka-sbt-plugin/sample/src/main/scala/HelloKernel.scala
new file mode 100644
index 0000000000..bef50fed72
--- /dev/null
+++ b/akka-sbt-plugin/sample/src/main/scala/HelloKernel.scala
@@ -0,0 +1,37 @@
+/**
+ * Copyright (C) 2009-2012 Typesafe Inc.
+ */
+package sample.kernel.hello
+
+import akka.actor.{ Actor, ActorSystem, ActorLogging, Props }
+import akka.kernel.Bootable
+
+case object Start
+
+class HelloActor extends Actor with ActorLogging {
+ val worldActor = context.actorOf(Props[WorldActor], name = "world")
+
+ def receive = {
+ case Start ⇒ worldActor ! "Hello"
+ case message: String ⇒
+ log.info("Received message [{}]", message)
+ }
+}
+
+class WorldActor extends Actor {
+ def receive = {
+ case message: String ⇒ sender ! (message.toUpperCase + " world!")
+ }
+}
+
+class HelloKernel extends Bootable {
+ val system = ActorSystem("hellokernel")
+
+ def startup = {
+ system.actorOf(Props[HelloActor], name = "hello") ! Start
+ }
+
+ def shutdown = {
+ system.shutdown()
+ }
+}
\ No newline at end of file
diff --git a/akka-sbt-plugin/src/main/scala/AkkaKernelPlugin.scala b/akka-sbt-plugin/src/main/scala/AkkaKernelPlugin.scala
index 5c1c5045af..08826fa5dd 100644
--- a/akka-sbt-plugin/src/main/scala/AkkaKernelPlugin.scala
+++ b/akka-sbt-plugin/src/main/scala/AkkaKernelPlugin.scala
@@ -126,7 +126,7 @@ object AkkaKernelPlugin extends Plugin {
"""|#!/bin/sh
|
|AKKA_HOME="$(cd "$(cd "$(dirname "$0")"; pwd -P)"/..; pwd)"
- |AKKA_CLASSPATH="$AKKA_HOME/lib/*:$AKKA_HOME/config"
+ |AKKA_CLASSPATH="$AKKA_HOME/config:$AKKA_HOME/lib/*"
|JAVA_OPTS="%s"
|
|java $JAVA_OPTS -cp "$AKKA_CLASSPATH" -Dakka.home="$AKKA_HOME" %s "$@"
@@ -135,7 +135,7 @@ object AkkaKernelPlugin extends Plugin {
private def distBatScript =
"""|@echo off
|set AKKA_HOME=%%~dp0..
- |set AKKA_CLASSPATH=%%AKKA_HOME%%\lib\*;%%AKKA_HOME%%\config
+ |set AKKA_CLASSPATH=%%AKKA_HOME%%\config;%%AKKA_HOME%%\lib\*
|set JAVA_OPTS=%s
|
|java %%JAVA_OPTS%% -cp "%%AKKA_CLASSPATH%%" -Dakka.home="%%AKKA_HOME%%" %s %%*