I\'m trying to implement akka in java maven project with NetBeans. It runs fine when i run it from NetBeans but when I run the runnable jar from NetBeans, it generate error.
There is a warning about running Akka from a "fat jar" at http://doc.akka.io/docs/akka/snapshot/general/configuration.html. The issue is that there are multiple reference.conf
configuration files, and the default behaviour of the Maven assembly or shade plugins is to overwrite earlier instances of the configuration file with later instances.
To fix this, the suggested approach is to use the Maven shade plugin to generate your executable jar and configure it to append all resource.conf
files into a single file instead of overwriting. The suggested Maven shade plugin configuration looks like:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>allinone</shadedClassifierName>
<artifactSet>
<includes>
<include>*:*</include>
</includes>
</artifactSet>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>reference.conf</resource>
</transformer>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<manifestEntries>
<Main-Class>akka.Main</Main-Class>
</manifestEntries>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>