Migrate Java 8 to Java 21: POM dependency and plugin updates (Steps 1-5)#3
Conversation
Step 1: Update maven.compiler.source/target from 1.8 to 21 in parent POM Step 2: Migrate javax.servlet and javax.enterprise deps to jakarta equivalents Step 3: Upgrade Jetty Maven plugin from 9.x to 12.x (ee10) Step 4: Upgrade Weld from 2.x to 5.x (weld-servlet-shaded) Step 5: Upgrade maven-war-plugin from 2.5 to 3.4.0 Co-Authored-By: tristan.farough <tfarough@gmail.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
| <groupId>org.eclipse.jetty.ee10</groupId> | ||
| <artifactId>jetty-ee10-maven-plugin</artifactId> | ||
| <version>12.0.14</version> |
There was a problem hiding this comment.
🔴 Jetty 12 ee10 plugin upgrade without updating XML configs that reference non-existent Jetty 9 classes
The Jetty plugin was upgraded from jetty-maven-plugin (Jetty 9) to jetty-ee10-maven-plugin (Jetty 12), but the XML configuration files still reference Jetty 9 class paths that don't exist in Jetty 12. Specifically, jetty-maven-cdi/src/main/webapp/WEB-INF/jetty-context.xml:3 and jetty-maven-cdi/src/main/webapp/WEB-INF/jetty-env.xml:3 both reference org.eclipse.jetty.webapp.WebAppContext, which in Jetty 12 ee10 has been relocated to org.eclipse.jetty.ee10.webapp.WebAppContext. Additionally, jetty-context.xml:6 references org.eclipse.jetty.servlet.ServletContextHandler.Decorator which has also been restructured. Both XML files also use the configure_9_0.dtd DOCTYPE which is obsolete in Jetty 12. This will cause the Jetty server to fail at startup with a ClassNotFoundException when processing these configuration files.
Prompt for agents
The Jetty plugin was upgraded to jetty-ee10-maven-plugin 12.0.14 but the XML configuration files were not updated for Jetty 12 compatibility.
Files that need updating:
1. jetty-maven-cdi/src/main/webapp/WEB-INF/jetty-context.xml:
- Change Configure class from org.eclipse.jetty.webapp.WebAppContext to org.eclipse.jetty.ee10.webapp.WebAppContext
- Update the DOCTYPE from configure_9_0.dtd to the Jetty 12 equivalent
- The serverClasses / org.eclipse.jetty.servlet.ServletContextHandler.Decorator pattern needs to be updated for Jetty 12's new architecture (server class filtering works differently in Jetty 12)
2. jetty-maven-cdi/src/main/webapp/WEB-INF/jetty-env.xml:
- Change Configure class from org.eclipse.jetty.webapp.WebAppContext to org.eclipse.jetty.ee10.webapp.WebAppContext
- Update the DOCTYPE from configure_9_0.dtd to the Jetty 12 equivalent
- Update javax.enterprise.inject.spi.BeanManager reference to jakarta.enterprise.inject.spi.BeanManager
- Update the JNDI Resource class from org.eclipse.jetty.plus.jndi.Resource to the Jetty 12 equivalent
Refer to the Jetty 12 migration guide for the correct class paths and configuration format.
Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
Acknowledged — this is intentionally deferred. The migration plan explicitly states to keep the existing <configuration> block as-is for now. The Jetty XML config file updates (jetty-context.xml, jetty-env.xml) — including class path relocations (org.eclipse.jetty.webapp → org.eclipse.jetty.ee10.webapp), DOCTYPE updates, and javax → jakarta references — will be addressed in subsequent migration steps that handle source and configuration file changes.
| <groupId>jakarta.servlet</groupId> | ||
| <artifactId>jakarta.servlet-api</artifactId> | ||
| <version>6.0.0</version> |
There was a problem hiding this comment.
🔴 Jakarta Servlet 6.0 dependency without updating web.xml namespace from Java EE to Jakarta EE
The servlet dependency was upgraded to jakarta.servlet-api:6.0.0 (Jakarta EE 10), but jetty-maven-cdi/src/main/webapp/WEB-INF/web.xml:2-5 and jetty-maven-cdi/src/main/webapp/WEB-INF/web-overwrite.xml:2-5 still declare the old Java EE namespace (http://java.sun.com/xml/ns/javaee with version="3.0"). Jakarta EE 10 requires the namespace https://jakarta.ee/xml/ns/jakartaee with version="6.0". With the Jetty 12 ee10 environment, the old namespace may cause the web application descriptor to be rejected or misinterpreted at deployment time. Additionally, web-overwrite.xml:15 references javax.enterprise.inject.spi.BeanManager which should be jakarta.enterprise.inject.spi.BeanManager.
Prompt for agents
The servlet API was upgraded to Jakarta Servlet 6.0 but the web descriptor XML files still use the old Java EE namespace.
Files that need updating:
1. jetty-maven-cdi/src/main/webapp/WEB-INF/web.xml:
- Change xmlns from http://java.sun.com/xml/ns/javaee to https://jakarta.ee/xml/ns/jakartaee
- Change xsi:schemaLocation to reference https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_6_0.xsd
- Change version from 3.0 to 6.0
2. jetty-maven-cdi/src/main/webapp/WEB-INF/web-overwrite.xml:
- Same namespace and version updates as web.xml
- Change javax.enterprise.inject.spi.BeanManager to jakarta.enterprise.inject.spi.BeanManager in the resource-env-ref-type element
Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
Acknowledged — this is intentionally deferred. This PR implements only the first 5 steps of a staged migration plan, which are scoped to POM file changes only. The web descriptor XML namespace updates (web.xml, web-overwrite.xml) and the javax.enterprise → jakarta.enterprise reference updates will be addressed in subsequent migration steps that cover the source/config file changes.
Summary
Implements the first 5 steps of the Java 8 to Java 21 migration plan. All changes are POM-only — no source code changes are included; those will follow in subsequent steps.
1.8→21pom.xmljavax.servlet-api3.1.0 →jakarta.servlet-api6.0.0;cdi-api1.2 →jakarta.enterprise.cdi-api4.0.1 (removed obsoletejavax.elexclusion)jetty-maven-cdi/pom.xml9.2.5→ Jetty ee10 plugin12.0.14(groupId/artifactId changed)jetty-maven-cdi/pom.xmlweld-servlet2.2.7 →weld-servlet-shaded5.1.2jetty-maven-cdi/pom.xmlmaven-war-plugin2.5 → 3.4.0jetty-maven-cdi/pom.xmlReview & Testing Checklist for Human
javax.*imports — this PR will intentionally break compilation until subsequent migration steps update the Java source tojakarta.*. Confirm this is acceptable as a staged migration.<contextXml>and<webApp><overrideDescriptor>config was kept as-is. Verify these config elements are still valid forjetty-ee10-maven-plugin:12.0.14.weld-servlet-shaded(vs the non-shadedweld-servlet-core) is the correct choice for the Jetty embedded use case.mvn validate(or a fullmvn compileafter source migration) with JDK 21 locally.Notes
javax.el:javax.el-apiexclusion was removed from the CDI dependency since it's no longer relevant in the Jakarta namespace.jetty-context.xml,web-overwrite.xml) undersrc/main/webapp/WEB-INF/may also need updates in a later step to align with Jetty 12 / Jakarta Servlet 6.Link to Devin session: https://app.devin.ai/sessions/3e9efb42bb974fb3b1e09dab71b8ad67
Requested by: @tfaro52