Bootstrap a JSF 2.3 Maven project in seconds

Last Updated:  September 12, 2020 | Published: January 3, 2019

Bootstrapping a new JSF can be quite cumbersome if you are new to Java EE. Even after weeks of training, I had to look up the anatomy of the or the correct folder structure. As the JSF technology is still a valid and reasoned choice for frontend development in enterprises, I've created a simple Maven archetype to bootstrap a ready-to-go JSF application in seconds.

If you are completely new to JSF, make sure you read one of my blog posts about this technology first: JavaServer Faces, Simple CRUD table with JSF 2.3, or this great book: The Definitive Guide to JSF in Java EE 8

UPDATE: You can find the latest version of this JSF archetype on GitHub. Since version 2.0.0 of this archetype, the application server of choice is Open Liberty.

What's included in the Maven archetype?

Using this Maven archetype you'll get a fresh project with the following dependencies and configurations:

  • Java EE 8 API dependency
  • Microprofile 3.3 dependency
  • Primefaces 8.0 and all-themes dependency
  • Omnifaces 3.6.1 dependency
  • Mockito and JUnit 5 dependencies for efficient testing
  • web.xml for JSF development with bootstrap as selected Primfaces theme
  • beans.xmlwith bean-discoery-mode="all"
  • persistence.xml configured for JTA persistence unit
  • for configuration
  • Simple index.xhtmlwith a backing bean SampleBean
  • a Dockerfile for the latest Open Liberty deployment at the root path level (“/”)
  • .gitignore with a configuration for Java development with the IDE of your choice
  • a script for a convenient Docker build and deployment for both Windows and Linux/Mac

Bootstrap a new JSF project

To use this archetype and to be able to deploy the project you need the following tools:

  • Java 11+ installation
  • Maven CLI (mvn) or the embedded Maven of the IDE of your choice
  • a running Docker daemon (optional, you can also deploy to a local application server)

The formal Maven command for creating a new project from my archetype looks like the following:

With this command, you just have to fill in your groupId and your artifactId and you'll be prompted to enter a version number or use the default 1.0-SNAPSHOT version.

For an even faster creation, you can use the following command to bypass the interactive mode:

With this, you have a ready-to-go Maven project setup for your Java EE 8 application. To deploy the application you can execute the buildAndRun.bat (for Windows) or (for Linux/Mac) file to create the .war, build the Docker image, and start a container afterward. If you have issues with executing the with ./ just make it executable with chmod +x

Right now the .war is about 5 MB big, as the additional JSF dependencies (Primefaces & Omnifaces) are packaged within the .war. To make this leaner you can add the dependencies to the application server of your choice and mark the dependencies within the pom.xml as <scope>provided</scope>. I'm also planning to do this with a custom Open Liberty Docker image in a future release of this archetype.

After the Payara server successfully started, you can visit http://localhost:9080/ and see the sample JSF page which displays an injected MicroProfile config property.

YouTube tutorial for this archetype

Furthermore, I've recorded a video for YouTube to show you how to use the archetype:

If you have any problems or improvements for this archetype, feel free to open an issue in the GitHub repository. For bootstrapping a simple Java EE 8 with Microprofile 3.3 application, have a look at my other Maven archetype.

Have fun bootstrapping new JSF applications with this archetype,


  • Hey Philip! Only one comment about the archetype, the generated JSF pages use the old namespace (java.sun…) instead of the new (xmlns…).

    Many thanks for the archetypes, they’re awesome if I want to use VS Code that can’t generate specific files like an IDE!

    • Hey Vasilis,

      thanks for this deprecation hint. I’ve fixed it and it will be part of the next release. I’m glad to hear that you like the archetypes.

      Kind regards,

  • {"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}