akka microkernel with maven

And then I have to use the Akka Microkernel.

Not that this is bad news. The bad news is that I have to do it with maven. The project I’m doing this for is already using maven, and has a few modules – which makes migrating to sbt out of question. Akka has a nice sbt plugin that generates the package for a microkernel distribution of your akka project – but there is no such thing for maven.

How to solve this problem with maven? Fortunately, it isn’t that hard. There are probably lots of other ways to do it, but my solution will use the maven-assembly-plugin. The boring part, as always with maven, is to write the proper xml. I’ve created a new assembly descriptor, called akka.xml, that goes as follows:

<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">

Two points to notice: the xml assumes an akka start script at src/main/resources/akka/start and a configuration file at src/main/resources/akka/application.conf, so you will have to create those. For me, I just copied the default start generated by the akka sbt plugin and created an empty application.conf, and will tweak them later.

Now, to enable the plugin add the following to the plugins section of your pom.xml:


This one also assumes something: the presence of the previous xml code, in the folder src/main/assembly/akka.xml.

That should do it! Now just unpack the zip file in your server and run your Bootable akka code =]



Since the xml mentioned above went through small tweaks, I added them in this GIST. So if you want to see the most recent version, go there 😉

This entry was posted in scala and tagged , , , , , , , , , , . Bookmark the permalink.

13 Responses to akka microkernel with maven

  1. Aaron Broad says:

    Excellent post, worked for me.

  2. Faisal A. says:

    That is a good post and appreciate it. I have tried to run the example but looks like I am getting some not exactly write. After creating the descriptor xml and updating the POM.xml , I runed the mvn assembly: asselby plugin. then maven complains that the start script is not a file. the start file am using is a batch file i copied from the akka examples from the git source.
    Is there any suggestion for me..

  3. Faisal A. says:

    Yes ,, that will be the likely problem.. I have given a description of the problem at the following stackoverflow link http://stackoverflow.com/questions/13269293/distributing-the-akka-micro-kernel-application-with-maven/13269633#13269633

    hope it will clarify the problem. Will be happy of know if there Is a workaround. Thanks.

  4. Faisal A. says:

    thanks for the suggestion. my application now works .

  5. Faisal says:

    I have tried the tutorials in this blog. When I check the zip package after running the assembly:single plugin goal or the package command from the maven , the deploy folder does not get created, only the lib, config and the bin folders are created. Was thinking that the deploy directory will also be created. Don’t know whether am right. Will be glad for an clarification.

  6. Faisal says:

    I have tried the tutorials on this blog. After using the assembly:assembly goal or package command , maven creates the lib, bin and config directories in te zip package but does not crate a deploy directory. but looks like from the Akka.xml descriptor file the assembly plugin is also expected to create a deploy directory. Looks like I might be missing something. Will be very happy for a clarification.

  7. Faisal says:

    looks like what I have is that maven copies all the jar files into the lib folder this includes the application that is developed to run on top of the akka microkernel

  8. Faisal says:

    was able to make maven create the deploy folder with the application developed as a jar file in the folder

  9. prasanthj says:

    Thanks for the post. Works flawlessly!!

  10. m.e. says:

    these instructions worked just fine for me too on scala 2.10, akka 2.1.2. thanks OP!

Leave a Reply

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

WordPress.com Logo

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

Facebook photo

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

Connecting to %s