I need to create a Nutch plugin that communicate with some external applications using Akka. In order to do this, I need to package the plugin as a fat Jar - I am using sbt-assembly version 0.8.3.
When I try to run the plugin, I get the exception
com.typesafe.config.ConfigException$Missing: No configuration setting found for key 'akka'
as if Akka was not able to find reference.conf
. This is weird, because sbt-assembly
should be able to package that file correctly, and in fact I can see its content in the created jar.
My build.sbt
looks like this:
import AssemblyKeys._
name := "my-project"
version := "0.1-SNAPSHOT"
scalaVersion := "2.10.0"
resolvers ++= Seq(
"Central Repo" at "http://repo1.maven.org/maven2",
"Typesafe Repository" at "http://repo.typesafe.com/typesafe/releases/",
"Akka io" at "http://akka.io/repository"
)
libraryDependencies ++= Seq(
...,
"com.typesafe.akka" %% "akka-actor" % "2.1.1",
"com.typesafe.akka" %% "akka-remote" % "2.1.1"
)
seq(assemblySettings: _*)
mergeStrategy in assembly <<= (mergeStrategy in assembly) { (old) =>
{
case "plugin.xml" =>
MergeStrategy.first
case x if x startsWith "org/apache/jasper" =>
MergeStrategy.last
case x if x startsWith "javax/xml" =>
MergeStrategy.last
case x if x startsWith "javax/servlet" =>
MergeStrategy.last
case x if x startsWith "org/apache/commons" =>
MergeStrategy.last
case x if x startsWith "org/apache/xmlcommons" =>
MergeStrategy.last
case x if x startsWith "org/xml/sax" =>
MergeStrategy.last
case x if x startsWith "org/w3c/dom" =>
MergeStrategy.last
case x => old(x)
}
}
The last lines are needed to fix some conflicts between nutch and hadoop.
What is the correct way to package an Akka application?