Skip to main content

Migrate to Jakarta EE 10

Jakarta EE 10 is the enterprise Java baseline that modern application servers, Spring, and a long tail of frameworks now build on. It carries forward the jakarta.* namespace introduced in Jakarta EE 9 – the rename of every javax.* enterprise package – and layers on new API versions such as Servlet 6.0, Persistence 3.1, and CDI 4.0, while removing methods and classes that had been deprecated for years.

For a codebase still on the javax.* APIs, that is a sprawling change: every enterprise import, every annotation attribute, every deployment descriptor, and every API dependency has to move in lockstep, and the deprecated-method removals are easy to miss until something fails at runtime.

The JakartaEE10 recipe applies these changes automatically: it migrates the javax.* namespace to jakarta.*, updates the Jakarta EE API and platform dependencies to their EE 10 versions, replaces deprecated APIs, and updates the XML descriptors and third-party libraries that need to move alongside them.

In this guide, we will show you how to run this recipe on the Moderne Platform or with the Moderne CLI.

Prerequisites

Before running this recipe, make sure:

  • Your codebase currently uses the javax.* enterprise APIs (Java EE or Jakarta EE 8) or an earlier Jakarta EE 9 release. JakartaEE10 includes the Jakarta EE 9 namespace migration transitively, so the javax to jakarta rename and the EE 10 updates are applied in a single run – you do not need to migrate to Jakarta EE 9 first.
  • Your build environment uses Java 11 or later. Jakarta EE 10 sets its baseline at Java SE 11 and also supports Java SE 17. If you are still on Java 8, run Migrate to Java 17 first and verify everything still builds.

What this recipe does

JakartaEE10 is a composite recipe that bundles many smaller transformations. Some of the most visible changes this recipe makes to your code include:

Beyond these source changes, the recipe also raises the Jakarta EE platform dependencies to 10.0.0, removes deprecated CDI 4.0 APIs, upgrades supporting libraries (Jersey 3.1, EclipseLink 4.x, Apache Shiro 2.0, Eclipse Yasson 3.0, and Apache Commons Email2 and FileUpload2), migrates Jakarta Faces to 4.x, upgrades Jetty EE9 to EE10, and updates build plugins in your Maven and Gradle files. For the complete list of sub-recipes, see the recipe catalog page.

Example

Here is a small servlet helper before and after JakartaEE10 runs:

Before
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

class SessionHandler {
void store(HttpSession session, String userId) {
session.putValue("user", userId);
}

String redirect(HttpServletResponse response, String url) {
return response.encodeUrl(url);
}
}
After
import jakarta.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpSession;

class SessionHandler {
void store(HttpSession session, String userId) {
session.setAttribute("user", userId);
}

String redirect(HttpServletResponse response, String url) {
return response.encodeURL(url);
}
}

Running the recipe

  1. Sign in to your Moderne tenant or app.moderne.io.
  2. (Optionally) Use the Organization selector to scope the run to the repositories you want to upgrade.
  3. Search for the Migrate to Jakarta EE 10 recipe (Moderne Platform link).
  4. Click Dry run.

For a step-by-step walkthrough of the Moderne Platform UI, see Quickstart: Using the Moderne Platform.

Reviewing and committing the changes

Running the recipe never modifies your source repositories directly. Instead, the changes are presented as a diff that you can inspect before deciding what to commit. Review them with whatever workflow fits your team, then use the Moderne Platform's commit options or the mod git CLI commands to push the changes across the affected repositories.

Additional reading

  • Migrate to Spring Boot 3 – Spring Boot 3 builds on this same javax.* to jakarta.* move, so start there if you are upgrading Spring applications.
  • Tracking migrations – use data tables and visualizations to track the rollout of a Jakarta EE 10 upgrade across many repositories.