I am experiencing problems building a runnable jar (one that includes all of the dependencies I need). I can build one that includes all of the dependencies as jars and it works but is very slow (I built it using Eclipse Export). I tried using the maven-assembly-plugin.
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>${mainClass}</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
This creates a Jar with all of the dependencies un-packaged. The problem is that the resultant jar throws an error when I run it (I get a null pointer exception in my code which appears to be cause by a factory class in one of the included libraries returning NULL).
The problem appears to be that when one of the dependent jars is un-packaged for inclusion into my jar something is going wrong (hence the error). I want to leave that jar packaged but still have it within my runnable jar.
Is there a way to selectively include the Jar packaged (or for that matter include all the jars packaged)?