Enable Maven 4 build and fix IT failures#3402
Closed
gnodet wants to merge 1 commit into
Closed
Conversation
Enable Maven 4 in the CI matrix by setting maven4-enabled: true. Exclude JDK 11 from Maven 4 cells since Maven 4 requires Java 17+ (JDK 8 is already auto-excluded by the shared workflow). Force forked JVM mode in MavenLauncher when Maven 4 is detected, working around maven-verifier 2.0.0-M1's broken embedded-mode reflection against the changed MavenCling.doMain() signature in Maven 4 rc-5. Detection checks for maven-cling-*.jar in the Maven home lib directory. This workaround can be removed once surefire migrates from maven-verifier to maven-executor. Also fix a pre-existing race condition in CountdownCloseable where awaitClosed() used 'if' instead of 'while' to guard Object.wait(), making it vulnerable to spurious wakeups per the JLS. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Author
|
Closing in favor of pushing directly to #3352's branch. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
maven4-enabled: true) with proper JDK 11 exclusionmaven-verifier:2.0.0-M1API incompatibility with Maven 4CountdownCloseableDetails
Maven 4 CI matrix
The shared workflow's matrix uses the exact version string
4.0.0-rc-5, so the exclude must match it exactly (not just"4"). JDK 8 is already auto-excluded by the shared workflow whenmaven4-enabled=true.IT failures — maven-verifier embedded mode
All integration tests fail with Maven 4 because
maven-verifier:2.0.0-M1uses reflection to callMavenCling.doMain(String[], String, PrintStream, PrintStream)in embedded mode, but Maven 4 rc-5 changed this method signature. The fix detects Maven 4 by checking formaven-cling-*.jarin the Maven home lib directory and forces forked JVM mode, bypassing the broken reflection entirely.This is a short-term workaround. The long-term fix is to migrate from
maven-verifier(which is being deprecated) to maven-executor (org.apache.maven.executor:maven-executor:1.0.0), which natively supports both Maven 3.x and 4.x.CountdownCloseable race condition
CountdownCloseable.awaitClosed()usedifinstead ofwhileto guardObject.wait(), making it vulnerable to spurious wakeups per the Java Language Specification. This is a pre-existing bug unrelated to Maven 4, but it could cause intermittentCommandlineExecutorTestfailures under different JVM timing.Related
Test plan
surefire-extensions-apiunit tests pass locally (includingCommandlineExecutorTest)mvn clean install -DskipTests)🤖 Generated with Claude Code