From b40c39915e6eb0f04b40be49d549fd98937235c9 Mon Sep 17 00:00:00 2001 From: Tim te Beek Date: Thu, 11 Jun 2026 09:51:04 +0200 Subject: [PATCH] Add junit-platform-launcher testRuntimeOnly dependency for Gradle during JUnit 6 migration --- src/main/resources/META-INF/rewrite/junit6.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/resources/META-INF/rewrite/junit6.yml b/src/main/resources/META-INF/rewrite/junit6.yml index 7aac224ff..31f366b17 100755 --- a/src/main/resources/META-INF/rewrite/junit6.yml +++ b/src/main/resources/META-INF/rewrite/junit6.yml @@ -66,6 +66,15 @@ recipeList: groupId: org.junit.jupiter artifactId: junit-jupiter* newVersion: 6.x + # Gradle no longer adds junit-platform-launcher to the test runtime classpath automatically; + # for Maven the maven-surefire-plugin already provides it, so only Gradle builds are changed. + - org.openrewrite.gradle.AddDependency: + groupId: org.junit.platform + artifactId: junit-platform-launcher + version: 6.x + onlyIfUsing: org.junit.jupiter.api.* + configuration: testRuntimeOnly + acceptTransitive: true - org.openrewrite.maven.UpgradePluginVersion: groupId: org.apache.maven.plugins artifactId: maven-failsafe-plugin