The following is the directory structure of my java application:
application.jar
dependency-jars
a.jar
b.jar
c.jar
The application executes fine when I use the following command: java -cp "application.jar;dependency-jars/*" com.my.Application
. In addition to application dependencies, 'dependency-jars' folder will also have jars dropped by its consumers. I want to make it an executable jar so as to make it easy for its consumers to invoke it. For creating executable jar I am making use of maven jar plugin. I want to simulate the above command line. I used the following maven jar plugin configuration:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<archive>
<manifest>
<mainClass>com.my.Application</mainClass>
<addClasspath>true</addClasspath>
</manifest>
<manifestEntries>
<Class-Path>dependency-jars/*</Class-Path>
</manifestEntries>
</archive>
</configuration>
</plugin>
The generated jar when executed is not able to find its dependencies at run time. Is there anything wrong with the above.
Thanks.