Enterprise Java

WildFly Swarm – Deploying Java EE Applications As Standalone Jars

WildFly Swarm provides an easy solution for deploying Java EE applications as a standalone Jar file. This makes it very easy to deploy applications, particularly REST or web services. Swarm is very similar to Spring Boot in that respect, in that it enables web (.War) applications to be developed quickly and then deployed as standalone applications without the need to deploy an application server.

The WildFly Swarm documentation describes itself as:

Swarm offers an innovative approach to packaging and running Java EE applications by packaging them with just enough of the platform to “java -jar” your application.

Deploying an Java EE application as a Swarm application is fairly straightforward:

  1. Add dependencies on the aspects of WildFly Swarm that you are to use to your project’s pom.xml file, for example, JAX-RS or JPA.
  2. Add the WildFly Swarm plugin to your project’s pom.xml file to enable an executable Jar file to be created.
  3. Sit back, relax and run your application as a standalone executable Jar !

To give a demonstration of how easy this is, I’ve created a very simple JAX-RS web service that returns a list of fruits – very similar to the Angular.js factory I created a few years ago.

The code for this sample application is available on GitHub

To create a JAX-RS web service and run as a WlidFly Swarm application, we just need to add the wildfly-swarm-jaxrs dependency. All of the dependencies that can be used with WildFly Swarm are documented in the User’s Guide



Adding the WildFly Swarm plugin to your pom.xml to create an executable Jar file is equally simple.


All you need to do now, is perform a mvn package command to create an executable Jar file which you can start by executing java -jar myJar.jar

When creating and running a Swarm application, it’s important to note that the URL for the application will be different from when running inside a standalone application server.

When the application is deployed under an application server, the context path with usually include the name of the deloyed application, for example:


When this is deployed as a Swarm application, the context path is not required (there is only one Java EE application running), so the URL will look something more like:


Want to know how to develop your skillset to become a Java Rockstar?

Join our newsletter to start rocking!

To get you started we give you our best selling eBooks for FREE!


1. JPA Mini Book

2. JVM Troubleshooting Guide

3. JUnit Tutorial for Unit Testing

4. Java Annotations Tutorial

5. Java Interview Questions

6. Spring Interview Questions

7. Android UI Design


and many more ....


Receive Java & Developer job alerts in your Area

I have read and agree to the terms & conditions


David Salter

David is a software developer who has been developing software professionally since 1991. He started programming in Java way back with Java 1.0 developing desktop applications and applets. Since 2001 he has been developing enterprise and web applications using both Java standards and open source solutions. David is the author of "NetBeans IDE 8 Cookbook", "Building SOA-Based Composite Applications using NetBeans 6" and "Seam 2.x Web Development”.
Notify of

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Inline Feedbacks
View all comments
Back to top button