I have a maven project that contains a set of dependencies that are local. I am using a Maven plugin to create a fat jar. Part of my pom.xml is the following:
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<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>
When I try to run the JAR using: java -cp myjar.jar MainClass I receive a runtime exception because it seems that a library is missing.
The library is defined as:
<dependency>
<groupId>edu.washington.knowitall</groupId>
<artifactId>reverb2</artifactId>
<version>2.0.1</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/reverb-latest.jar</systemPath>
</dependency>
If I run my JAR using: java -cp myjar.jar:lib/reverb-latest.jar Everything runs perfectly.
However, If I run my main class inside eclipse everything runs perfectly.
I create the package using:
mvn clean
mvn install