diff --git a/akka-docs/rst/scala/microkernel.rst b/akka-docs/rst/scala/microkernel.rst index 7f35bdddb1..ca30ab0b95 100644 --- a/akka-docs/rst/scala/microkernel.rst +++ b/akka-docs/rst/scala/microkernel.rst @@ -12,31 +12,36 @@ The Akka Microkernel is included in the Akka download found at `downloads`_. .. _downloads: http://akka.io/downloads -To run an application with the microkernel you need to create a Bootable class -that handles the startup and shutdown the application. An example is included below. - -Put your application jar in the ``deploy`` directory and additional dependencies in the ``lib`` directory -to have them automatically loaded and placed on the classpath. - -To start the kernel use the scripts in the ``bin`` directory, passing the boot -classes for your application. - -The start script adds ``config`` directory first in the classpath, followed by ``lib/*``. -It runs java with main class ``akka.kernel.Main`` and the supplied Bootable class as -argument. - -Example command (on a unix-based system): - -.. code-block:: none - - bin/akka sample.kernel.hello.HelloKernel - -Use ``Ctrl-C`` to interrupt and exit the microkernel. - -On a Windows machine you can also use the bin/akka.bat script. +To run an application with the microkernel you need to create a Bootable class +that handles the startup and shutdown the application. The code for the Hello Kernel example (see the ``HelloKernel`` class for an example of creating a Bootable): .. includecode:: ../../../akka-samples/akka-sample-hello-kernel/src/main/scala/sample/kernel/hello/HelloKernel.scala + +Add `sbt-native-packager `_ to the plugins.sbt + +.. code-block:: none + + addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "0.8.0-M2") + +Use the package settings for ``akka_application``, and specify the mainClass in build.sbt + +.. includecode:: ../../../akka-samples/akka-sample-hello-kernel/build.sbt + + +Use sbt task ``stage`` to generate the start script. Also you can use task ``universal:packageZipTarball`` to package the application. + +To start the application (on a unix-based system): + +.. code-block:: none + + ./target/universal/stage/bin/hello-kernel + +Use ``Ctrl-C`` to interrupt and exit the microkernel. + +On a Windows machine you can also use the ``target\universal\stage\bin\hello-kernel.bat`` script. + + diff --git a/akka-samples/akka-sample-hello-kernel/build.sbt b/akka-samples/akka-sample-hello-kernel/build.sbt new file mode 100644 index 0000000000..dcb2c44dfb --- /dev/null +++ b/akka-samples/akka-sample-hello-kernel/build.sbt @@ -0,0 +1,12 @@ +import NativePackagerKeys._ + +packageArchetype.akka_application + +name := """hello-kernel""" + +mainClass in Compile := Some("sample.kernel.hello.HelloKernel") + +libraryDependencies ++= Seq( + "com.typesafe.akka" %% "akka-kernel" % "2.4-SNAPSHOT", + "com.typesafe.akka" %% "akka-actor" % "2.4-SNAPSHOT" +) diff --git a/akka-samples/akka-sample-hello-kernel/project/plugins.sbt b/akka-samples/akka-sample-hello-kernel/project/plugins.sbt new file mode 100644 index 0000000000..d46b62b0fd --- /dev/null +++ b/akka-samples/akka-sample-hello-kernel/project/plugins.sbt @@ -0,0 +1 @@ +addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "0.8.0-M2") diff --git a/project/plugins.sbt b/project/plugins.sbt index 7838eafd15..96e6cd458c 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -23,5 +23,9 @@ addSbtPlugin("com.eed3si9n" % "sbt-unidoc" % "0.3.1") addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "0.6.2") +// needed for the akka-sample-hello-kernel +// it is also defined in akka-samples/akka-sample-hello-kernel/project/plugins.sbt +addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "0.8.0-M2") + // stats reporting libraryDependencies += "com.timgroup" % "java-statsd-client" % "2.0.0"