Skip to content
This repository has been archived by the owner on Jun 7, 2021. It is now read-only.

Latest commit

 

History

History

static-war

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Simple .war with Static Resources Example

This example takes a normal WAR build, and wraps it into a -thorntail runnable jar.

Please raise any issues found with this example in our JIRA: https://issues.jboss.org/browse/THORN

Project pom.xml

This project is a traditional servlet project, with maven packaging of war in the pom.xml

<packaging>war</packaging>

The project adds a <plugin> to configure thorntail-maven-plugin to create the runnable .jar.

<plugin>
  <groupid>io.thorntail</groupId>
  <artifactId>thorntail-maven-plugin</artifactId>
  <version>${version.thorntail}</version>
  <executions>
    <execution>
      <goals>
        <goal>package</goal>
      </goals>
    </execution>
  </executions>
</plugin>

To define the needed parts of Thorntail, a dependency is added

<dependency>
    <groupid>io.thorntail</groupId>
    <artifactId>undertow</artifactId>
    <version>${version.thorntail}</version>
</dependency>

This project contains no Java code, simply resources to be served statically from within the .war

Run

You can run it many ways:

  • mvn package && java -jar ./target/example-static-war-thorntail.jar
  • mvn thorntail:run
  • In your IDE run the org.wildfly.swarm.Swarm class

Use

Since Thorntail apps tend to support one deployment per executable, it automatically adds a jboss-web.xml to the deployment if it doesn't already exist. This is used to bind the deployment to the root of the web-server, instead of using the .war's own name as the application context.

http://localhost:8080/