I would like to include an external jar (specified in the dependencies) inside the jar with dependencies.
pom.xml dependency:
<dependency>
<groupId>my.package</groupId>
<artifactId>my-artifact</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${basedir}\..\lib\my-artifact.jar</systemPath>
</dependency>
Here is the code for jar-with-dependencies:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>CtrlpConversion</id>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>my.package.Main</mainClass>
<packageName>my.package</packageName>
</manifest>
</archive>
<finalName>MyExecutable</finalName>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
The .jar generated by this pom.xml does not include the classes of my-artifact.jar. And when I try to run the main I get the following error:
Exception in thread "main" java.lang.NoClassDefFoundError: my/package/ClassThatINeed
at my.package.Main.main(Main.java:29)
Caused by: java.lang.ClassNotFoundException: my.package.ClassThatINeed
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 1 more
I would love to have some help in finding the solution to this issue. Thank you!!