Chapter 8. Packaging your application

This sections contains information about packaging your Thorntail–based application for deployment and execution.

8.1. Packaging Types

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

8.1.1. 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 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 Thorntail produces include the name of your application and the -thorntail.jar suffix.

An uberjar can be executed like any executable JAR:

$ java -jar myapp-thorntail.jar

8.1.2. 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 Thorntail produces include the name of your application, and the -hollow-thorntail.jar suffix. You must package the .war file of your application separately in order to benefit from the hollow JAR.


Using hollow JARs has certain limitations:

  • To enable Thorntail to autodetect a JDBC driver, you must add the JAR with the driver to the thorntail.classpath system property, for example:

    $ java -Dthorntail.classpath=./h2-1.4.196.jar -jar my-hollow-thorntail.jar myApp.war
  • YAML configuration files in your application are not automatically applied. You must specify them manually, for example:

    $ java -jar my-hollow-thorntail.jar myApp.war -s ./project-defaults.yml

When executing the hollow JAR, provide the application .war file as an argument to the Java binary:

$ java -jar myapp-hollow-thorntail.jar myapp.war Pre-Built Hollow JARs

Thorntail ships the following pre-built hollow JARs:

Functionality focused on web technologies
Functionality defined by all Eclipse MicroProfile specifications

The hollow JARs are available under the following coordinates:


8.2. Creating an uberjar

One method of packaging an application for execution with Thorntail is as an uberjar.


  • A Maven-based application with a pom.xml file.


  1. Add the thorntail-maven-plugin to your pom.xml in a <plugin> block, with an <execution> specifying the package goal.

  2. Perform a normal Maven build:

    $ mvn package
  3. Execute the resulting uberjar:

    $ java -jar ./target/myapp-thorntail.jar