Skip to content

fix(examples): unblock JUnit 6 for the Java 11 examples - #1897

Merged
github-actions[bot] merged 2 commits into
mainfrom
examples-junit-launcher-scope
Sep 28, 2026
Merged

github-actions[bot] merged 2 commits into
mainfrom
examples-junit-launcher-scope

Conversation

@Frisch12

Copy link
Copy Markdown
Member

Supersedes #1838.

Problem

examples/build.gradle added junit-platform-launcher to every Java example. :lombok builds with a Java 11 toolchain, so Gradle resolves the launcher for JVM 11, and JUnit 6 only publishes variants for Java 17+:

Dependency resolution is looking for a library compatible with JVM runtime version 11, but 'org.junit.platform:junit-platform-launcher:6.1.3' is only compatible with JVM runtime version 17 or newer.

:lombok and :aspectj:aspect (targetCompatibility = "11") have no tests, so they never needed the launcher.

Change

  • Declare the launcher only in jacoco/sub-a and jacoco/sub-b, the two examples that run useJUnitPlatform(). The integrationTest suite in aspectj/weaving gets its launcher from JvmTestSuite; the other test tasks run JUnit 4.
  • Bump org.junit:junit-bom to 6.1.3 in /examples (the change from Bump org.junit:junit-bom from 5.13.4 to 6.1.3 in /examples #1838).

The Java 11 examples stay. They are the only coverage for a consumer toolchain older than the JVM Gradle runs on.

Verification (local, Java 17)

  • Before the fix, with BOM 6.1.3: :lombok:dependencies --configuration testRuntimeClasspath reports the launcher as FAILED.
  • After the fix: every classpath configuration of :lombok, :lombok:mapstruct, :lombok:sonarqube and :aspectj:aspect resolves.
  • cd examples && ./gradlew assemble check --continue → BUILD SUCCESSFUL. JUnit Platform tests ran: jacoco:sub-a, jacoco:sub-b, aspectj:weaving:integrationTest, 0 failures.

The launcher was added to every Java example, including the ones that
compile against a Java 11 toolchain and have no tests at all. JUnit 6
requires Java 17, so resolving its launcher for those projects fails
and blocks the JUnit BOM upgrade. Declaring it only in the projects
that use useJUnitPlatform() keeps the Java 11 examples building.
@Frisch12 Frisch12 added the auto-merge-ok label Sep 28, 2026 — with Claude
@github-actions
github-actions Bot merged commit 83eea89 into main Sep 28, 2026
21 checks passed
@github-actions
github-actions Bot deleted the examples-junit-launcher-scope branch September 28, 2026 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant