Skip to content

MYFACES-4784: Quarkus 4 / CDI 5.0 / Java 21 - #1144

Merged
tandraschko merged 1 commit into
apache:mainfrom
melloware:MYFACES-4784-quarkus-4
Nov 26, 2026
Merged

tandraschko merged 1 commit into
apache:mainfrom
melloware:MYFACES-4784-quarkus-4

Conversation

@melloware

@melloware melloware commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

MYFACES-4784

Original Issue: quarkiverse/quarkus-primefaces#546

Faces 5.0 targets Jakarta EE 12. This PR:

  1. Moves the Quarkus extension to Quarkus 4.0.0 (GA, EE12-based).
  2. Compiles MyFaces against CDI 5.0.0.
  3. Fixes DefaultELResolverBuilder, which called BeanManager.getELResolver(). CDI 5.0 removed that method.
  4. Raises the minimum Java version to 21 across the build and CI. Both Quarkus 4 and Jakarta EE 12 require it.

1. BeanManager.getELResolver() was removed in CDI 5.0

Quarkus 4 depends on CDI 5.0.0 (jakarta.cdi:jakarta.cdi-api). In CDI 5.0, BeanManager no longer has any EL methods. EL integration is now only in the separate jakarta.cdi:jakarta.cdi-el-api artifact, through jakarta.enterprise.inject.spi.el.ELAwareBeanManager. The package name hasn't changed since 4.1.

DefaultELResolverBuilder.getCDIELResolver() had a latent bug. It checked instanceof ELAwareBeanManager but then called beanManager.getELResolver() on the plain BeanManager type anyway, and called it again unconditionally on the last line. Against the CDI 5 API that does not compile, and on a CDI 5 runtime it would throw NoSuchMethodError.

New behaviour (impl/src/main/java/org/apache/myfaces/el/DefaultELResolverBuilder.java):

  • If ELAwareBeanManager is on the classpath and the bean manager implements it, the method casts to it and calls getELResolver() (pattern-matching instanceof).
  • Otherwise it calls getELResolver() reflectively. This covers older CDI containers whose BeanManager still has the deprecated method.
  • If neither works, it throws an IllegalStateException with a clear message instead of a NoSuchMethodError.

Quarkus impact: QuarkusELResolverBuilder already overrides getCDIELResolver() with its own QuarkusCdiELResolver, so this code path isn't used on Quarkus. The only change there is a javadoc {@link} that pointed at the removed method.

Points for review

  • The reflective fallback. It is only for CDI < 4.1 runtimes, and it only matters if we still want to run on CDI 4.0. If Faces 5.0 formally requires CDI 5 (EE12), we could delete the fallback and the ExternalSpecifications.isCDI41Available() check. Removing them would make jakarta.cdi-el-api a hard runtime requirement for the CDI resolver.
  • The README's "CDI 4.0+" minimum. I left it alone, because the fallback keeps CDI 4.0 working.

2. CDI API 5.0.0

The CDI API's Maven coordinates moved. The old jakarta.enterprise:jakarta.enterprise.cdi-api:5.0.0 is only a relocation pom.

Before After
jakarta.enterprise:jakarta.enterprise.cdi-api:4.1.0 jakarta.cdi:jakarta.cdi-api:5.0.0
jakarta.enterprise:jakarta.enterprise.cdi-el-api:4.1.0 jakarta.cdi:jakarta.cdi-el-api:5.0.0

Updated in parent/pom.xml (dependencyManagement), api, impl, bundle, and integration-tests. Because MyFaces now compiles against the EE12 API, any remaining use of a removed CDI method would fail the build. Apart from getELResolver() there were none.

Not changed: benchmark/pom.xml keeps CDI 4.1.0. It runs on Weld 6, which implements CDI 4.1, and it isn't part of the reactor. Only its Java release was raised to 21.

3. Quarkus 3.27.1 → 4.0.0

File Change
extensions/quarkus/pom.xml quarkus.version 3.27.1 → 4.0.0
extensions/quarkus/showcase/pom.xml quarkus-junit5 → quarkus-junit (renamed in Quarkus 4)
extensions/quarkus/showcase/pom.xml Override junit-jupiter-api to 6.1.3. The parent pom pins 5.13.4, and that direct dependencyManagement entry wins over the imported Quarkus BOM, which caused a JUnit 5/6 mismatch (NoClassDefFoundError) when surefire started.
extensions/quarkus/showcase/pom.xml surefire/failsafe 3.2.5 → 3.5.4
extensions/quarkus/showcase/pom.xml quarkus-maven-plugin gets <extensions>true</extensions>, as in Quarkus 4 app projects
extensions/quarkus/showcase/pom.xml Native profile: removed quarkus.package.type=native → quarkus.native.enabled=true
showcase/.../application.properties quarkus.log.file.enable → quarkus.log.file.enabled. Quarkus 4 ignores the old name and logs a warning.

I checked the runtime and deployment modules against the other Quarkus 4 breaking changes, and none apply:

  • QuarkusUnitTest → QuarkusExtensionTest: not used.
  • Dev UI JsonRPCProvidersBuildItem package move: not used.
  • Jackson 3: not used.
  • Legacy META-INF/native-image/*-config.json: none shipped.
  • Regex resource patterns → globs: NativeImageResourceBuildItem only uses literal paths.
  • query* reflection flags and lambdaCapturingTypes: not used.

4. Java 21

  • pom.xml, parent/pom.xml, integration-tests/pom.xml: java.version 17 → 21.
  • benchmark/pom.xml: maven.compiler.release 17 → 21.
  • extensions/quarkus/showcase/pom.xml: java.version 17 → 21.
  • README.md: minimum requirement "Java 17+" → "Java 21+".
  • CI:
    • .github/workflows/myfaces-ci.yml: JDK 17 → 21.
    • .github/workflows/codeql-analysis.yml: JDK 17 → 21.
    • Jenkinsfile: jdk_17_latest → jdk_21_latest (build matrix and deploy stage).

Testing

Run locally with Temurin 25, compiling for release 21:

What Result
mvn clean install, all reactor modules ✅ Build
impl tests ✅ 1787 run, 0 failures, 2 skipped
Quarkus showcase tests (@QuarkusTest) on Quarkus 4.0.0 ✅ 3 pass, 1 skipped (already @Disabled, HtmlUnit websocket)
integration-tests (test-compile) ✅ Compiles
Native image (-Dnative, mandrel container build) ⚠️ Not run. Docker wasn't available locally. Quarkus 4 requires a Mandrel/GraalVM 25 builder, which the container build picks automatically. Please check the native build in CI or by hand.

🤖 Generated with Claude Code

@melloware

Copy link
Copy Markdown
Contributor Author

Merge #1145 first and then rebase this one

@melloware
melloware marked this pull request as draft November 22, 2026 14:09
@tandraschko

Copy link
Copy Markdown
Member

EE12 is Java21+
so we need at least a build with Java21, to not break something.

- Migrate the Quarkus extension to Quarkus 4.0.0
- Compile against CDI 5.0.0 (jakarta.cdi:jakarta.cdi-api / jakarta.cdi-el-api)
- DefaultELResolverBuilder: obtain the CDI ELResolver via ELAwareBeanManager,
  since BeanManager#getELResolver() was removed in CDI 5.0
- Require Java 21 across the build and CI

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@melloware
melloware force-pushed the MYFACES-4784-quarkus-4 branch from 23587d4 to 1a4a550 Compare November 26, 2026 11:56
@melloware

Copy link
Copy Markdown
Contributor Author

All builds are now on JDK 21: GitHub CI, CodeQL, Jenkins matrix and deploy, and java.version in the poms. Rebased on main after #1145.

@melloware
melloware marked this pull request as ready for review November 26, 2026 11:57
@tandraschko
tandraschko merged commit 9f76587 into apache:main Nov 26, 2026
4 checks passed
@melloware
melloware deleted the MYFACES-4784-quarkus-4 branch November 26, 2026 12:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants