[#packaging_types]
= Packaging Types

When using WildFly Swarm, there are the following ways to package your
runtime and application, depending on how you intend to use and deploy
it:

[#uberjar]
== Uberjar

An _uberjar_ is a single Java `.jar` file that includes everything you need
to execute your application. This means both the runtime components
you have selected--you can understand that to as the app server-- along with
the application components (your `.war` file).

An uberjar is useful for many continuous integration and continuous deployment
(CI/CD) pipeline styles, in which a single executable binary artifact is produced
and moved through the testing, validation, and production environments in your
organization.

The names of the uberjars that WildFly Swarm produces include the name of your
application and the `-swarm.jar` suffix.

An uberjar can be executed like any executable JAR:

[source]
----
$ java -jar myapp-swarm.jar
----

[#hollow-jar]
== Hollow JAR

A _hollow JAR_ is similar to an uberjar, but includes only
the runtime components, and does not include your application code.

A hollow jar is suitable for deployment processes that involve Linux
containers such as Docker. When using containers,  place the runtime components
in a container image lower in the image hierarchy--which means it changes less
often--so that the higher layer which contains only your application code can
be rebuilt more quickly.

The names of the hollow JARs that WildFly Swarm produces include the name of
your application, and the `-hollow-swarm.jar` suffix. You must package the
`.war` file of your application separately in order to benefit from the hollow
JAR.

Provide the application `.war` file as an argument to the Java binary when
executing the hollow JAR:

[source]
----
$ java -jar myapp-hollow-swarm.jar myapp.war
----

=== Pre-Built Hollow JARs

WildFly Swarm ships the following pre-built hollow JARs:

full:: The main Java EE related capabilities
web:: A smaller functional scope, focused on web technologies
microprofile:: Functionality defined by all Eclipse MicroProfile specifications

The hollow JARs are available under the following coordinates:

[source,xml,options="nowrap"]
----
<dependency>
    <groupId>org.wildfly.swarm.servers</groupId>
    <artifactId>[full|web|microprofile]</artifactId>
</dependency>
----

[NOTE]
====
anchor:hollow-jar-limitations[]Using hollow JARs has certain limitations:

* To enable WildFly Swarm to autodetect a JDBC driver, you must add the JAR with the driver to the `swarm.classpath` system property, for example:
+
[source,bash,options="nowrap"]
----
$ java -Dswarm.classpath=./h2-1.4.196.jar -jar my-hollow-swarm.jar myApp.war
----

* YAML configuration files in your application are not automatically applied.
You must specify them manually, for example:
+
[source,bash,options="nowrap"]
----
$ java -jar my-hollow-swarm.jar myApp.war -s ./project-defaults.yml
----
====

