First of all, you should be aware of security in Java. Many jars will not work in fatjars if they are included in other projects (e.g. bouncycastle).
If you make a simple executable jar that does not have libs, and all of them are required on the way to the classes, the default assembly (when the packageing tag is set to jar) will be fine and you just need the appropriate manifest.
If you need all the libraries inside (fatjar), you need to configure it yourself.
There are several plugins for it, for example maven-shade-plugin :
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> <version>2.3</version> <configuration> <filters> <filter> <artifact>*:*</artifact> <excludes> <exclude>META-INF/*.SF</exclude> <exclude>META-INF/*.RSA</exclude> <exclude>META-INF/*.INF</exclude> </excludes> </filter> </filters> <transformers> <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> <manifestEntries> <Main-Class>my.package.MainClass</Main-Class> <Class-Path>.</Class-Path> </manifestEntries> </transformer> </transformers> <shadedArtifactAttached>true</shadedArtifactAttached> <shadedClassifierName>fat</shadedClassifierName> </configuration> <executions> <execution> <phase>package</phase> <goals> <goal>shade</goal> </goals> </execution> </executions> </plugin>
source share