Create Jakarta EE application using Maven in Eclipse

In this tutorial, I will guide you all on how to create a new Jakarta EE application support Maven in Eclipse.

First, in Eclipse, go to File, select New and select Maven project:

Create web application using Maven in Eclipse

To create a Jakarta EE project with Maven, we will use Maven Archetype with Archetype for web application.

In the above window, we will not choose Create a simple project (skip archetype selection), leave the default, and then click the Next button.

Create web application using Maven in Eclipse

This is the window that allows us to select the Maven Archetype. Maven Archetype for Jakarta EE application is called maven-archetype-webapp so please choose it:

then click Next button:

Create web application using Maven in Eclipse

This is the window that allows us to change the values of Maven Group Id, Maven Artifact Id, Version, and also the package name.

I will fill these values as follows:

Click Finish to complete.


As you can see, our project is reporting an error.

The reason is that the default Maven Archetype that we are using does not declare the Jakarta EE Servlet API dependency in the pom.xml file:

so we need to do this.

Please open the pom.xml file and add this dependency:

with jakarta.jakartaee-api.version declared as follows:

As you can see, I also declared using Java 11, using JUnit 5:

and using Maven Jetty Plugin:

to run our application.

The contents of my pom.xml file after editing are as follows:

The web.xml file also needs to be edited to match the Jakarta EE Servlet application, specifically as follows:

Result when running the application:

Add Comment