[#creating-a-hollow-jar]
= Creating a hollow JAR

The xref:hollow-jar[hollow JAR] is one method of packaging an application for execution with WildFly Swarm.

.Prerequisites

* A Maven-based application with a `pom.xml` file.

.Procedure

. Add the `wildfly-swarm-plugin` to your `pom.xml` in a `<plugin>` block, with an `<execution>` specifying the `package` goal.
In addition to that, put `true` in the `hollow` property of the `<configuration>` element:
+
--
[source,xml]
----
<plugins>
include::pom.xml[tag=plugin,indent=2]
</plugins>
----

You can also execute the Maven binary with the system property `-Dswarm.hollow=true` instead. For more information, see the xref:maven-plugin-configuration[Maven plugin configuration reference].
--

. Perform a normal Maven build:
+
[source]
----
$ mvn package
----

. Execute the hollow JAR:
+
Execute the resulting `-hollow-swarm.jar` file using the Java binary and pass the `.war` file with your application as the first argument:
+
[source]
----
$ java -jar ./target/myapp-hollow-swarm.jar ./target/myapp.war
----

.Related Information

* xref:hollow-jar[]
* xref:creating-an-uberjar[]
* xref:hollow-jar-limitations[Limitations of using hollow JARs]

