Ce contenu n'est pas disponible dans la langue sélectionnée.

Chapter 9. Packaging your application


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

9.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:

9.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
Copy to Clipboard Toggle word wrap

9.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.

Note

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
    Copy to Clipboard Toggle word wrap
  • 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
    Copy to Clipboard Toggle word wrap

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
Copy to Clipboard Toggle word wrap

9.1.2.1. Pre-Built Hollow JARs

Thorntail ships the following pre-built hollow JARs:

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

The hollow JARs are available under the following coordinates:

<dependency>
    <groupId>io.thorntail.servers</groupId>
    <artifactId>[web|microprofile]</artifactId>
</dependency>
Copy to Clipboard Toggle word wrap

9.2. Creating an uberjar

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

Prerequisites

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

Procedure

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

    <plugins>
      <plugin>
        <groupId>io.thorntail</groupId>
        <artifactId>thorntail-maven-plugin</artifactId>
        <version>${version.thorntail}</version>
        <executions>
          <execution>
            <id>package</id>
            <goals>
              <goal>package</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
    Copy to Clipboard Toggle word wrap
  2. Perform a normal Maven build:

    $ mvn package
    Copy to Clipboard Toggle word wrap
  3. Execute the resulting uberjar:

    $ java -jar ./target/myapp-thorntail.jar
    Copy to Clipboard Toggle word wrap
Retour au début
Red Hat logoGithubredditYoutubeTwitter

Apprendre

Essayez, achetez et vendez

Communautés

À propos de la documentation Red Hat

Nous aidons les utilisateurs de Red Hat à innover et à atteindre leurs objectifs grâce à nos produits et services avec un contenu auquel ils peuvent faire confiance. Découvrez nos récentes mises à jour.

Rendre l’open source plus inclusif

Red Hat s'engage à remplacer le langage problématique dans notre code, notre documentation et nos propriétés Web. Pour plus de détails, consultez le Blog Red Hat.

À propos de Red Hat

Nous proposons des solutions renforcées qui facilitent le travail des entreprises sur plusieurs plates-formes et environnements, du centre de données central à la périphérie du réseau.

Theme

© 2025 Red Hat