Using thin JARs
You will be able to create a thin JAR. A thin JAR does not contain its Maven dependencies and loads them during application startup from a local or remote Maven repository.
Let's take a look at an example:
(...)
<build>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>${version.war.plugin}</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.wildfly.swarm</groupId>
<artifactId>wildfly-swarm-plugin</artifactId>
<version>${version.wildfly.swarm}</version>
<!-- 1 -->
<configuration>
<bundleDependencies>false</bundleDependencies>
</configuration>
<executions>
<execution>
<goals>
<goal>package</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
(...)
When we build the application and look at the target directory, we get the following result:
Note that in the preceding scenario, all the JARs are very small with the runnable JAR of 744 KB.
You also have the possibility to mix thin JARs with hollow JARs. The runnable JAR does not contain the application that has to be deployed on it, so it has to be run in the same way as in the preceding example:
java jar catalog-1.0-hollow-swarm.jar catalog-1.0.war
Both the server and the deployment do not contain bundled dependencies, so they have to be loaded from the Maven repository using the application deployment.