Questo contenuto non è disponibile nella lingua selezionata.

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

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
  • 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

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>

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>
  2. Perform a normal Maven build:

    $ mvn package
  3. Execute the resulting uberjar:

    $ java -jar ./target/myapp-thorntail.jar
Red Hat logoGithubredditYoutubeTwitter

Formazione

Prova, acquista e vendi

Community

Informazioni sulla documentazione di Red Hat

Aiutiamo gli utenti Red Hat a innovarsi e raggiungere i propri obiettivi con i nostri prodotti e servizi grazie a contenuti di cui possono fidarsi. Esplora i nostri ultimi aggiornamenti.

Rendiamo l’open source più inclusivo

Red Hat si impegna a sostituire il linguaggio problematico nel codice, nella documentazione e nelle proprietà web. Per maggiori dettagli, visita il Blog di Red Hat.

Informazioni su Red Hat

Forniamo soluzioni consolidate che rendono più semplice per le aziende lavorare su piattaforme e ambienti diversi, dal datacenter centrale all'edge della rete.

Theme

© 2026 Red Hat
Torna in cima