I want to create a jar file from a maven project. I need to use an own assembly.xml because I need to exclude a few .so files:
assembly.xml
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>assembly-with-so</id>
<formats>
<format>jar</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
<!-- package the regular dependencies -->
<dependencySet>
<outputDirectory>/</outputDirectory>
<useProjectArtifact>true</useProjectArtifact>
<unpack>true</unpack>
<scope>runtime</scope>
<excludes>
<exclude>jcuda:libJCublas:so:linux-x86_64:0.6.5</exclude>
[...]
</excludes>
</dependencySet>
<dependencySet>
<outputDirectory>/</outputDirectory>
<includes>
<include>jcuda:libJCublas:so:linux-x86_64:0.6.5</include>
[...]
</includes>
</dependencySet>
</dependencySets>
</assembly>
pom.xml
[...]
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>jar-with-dependencies</id>
<phase>prepare-package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
<configuration>
<descriptor>src/main/assembly/assembly.xml</descriptor>
<appendAssemblyId>false</appendAssemblyId>
<archive>
<manifest>
<mainClass>org.test.Test</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
[...]
</build>
When I start the jar file using java -jar File.jar
I'm getting the error that the class org.test.Test
is missing. When I open the .jar file to have a look what's in it, I see that every file of the dependencies are there but the files of the main project are missing.