From 829494f538d49de5e417f4a92b1d89af809b9f49 Mon Sep 17 00:00:00 2001 From: David Nestorovic Date: Wed, 2 Apr 2025 16:29:23 +0200 Subject: [PATCH 1/5] Avoid adding duplicated junit entries on classpath --- common/junit-platform-native/build.gradle | 12 +++-- .../platform/NativeImageJUnitLauncher.java | 21 +++++++- .../buildtools/maven/NativeTestMojo.java | 53 +++++++++++++++++++ 3 files changed, 80 insertions(+), 6 deletions(-) diff --git a/common/junit-platform-native/build.gradle b/common/junit-platform-native/build.gradle index 6231a8486..2d5421eb6 100644 --- a/common/junit-platform-native/build.gradle +++ b/common/junit-platform-native/build.gradle @@ -52,12 +52,16 @@ maven { } dependencies { compileOnly libs.graalvm.svm - implementation(platform(libs.test.junit.bom)) - implementation libs.test.junit.platform.console - implementation libs.test.junit.platform.launcher - implementation libs.test.junit.jupiter.core + compileOnly(platform(libs.test.junit.bom)) + compileOnly libs.test.junit.platform.console + compileOnly libs.test.junit.platform.launcher + compileOnly libs.test.junit.jupiter.core testImplementation libs.test.junit.vintage + + testRuntimeOnly(platform(libs.test.junit.bom)) + testRuntimeOnly libs.test.junit.platform.console testRuntimeOnly libs.test.junit.platform.launcher + testRuntimeOnly libs.test.junit.jupiter.core } apply from: "gradle/native-image-testing.gradle" diff --git a/common/junit-platform-native/src/main/java/org/graalvm/junit/platform/NativeImageJUnitLauncher.java b/common/junit-platform-native/src/main/java/org/graalvm/junit/platform/NativeImageJUnitLauncher.java index 5829d6f42..4372adc55 100644 --- a/common/junit-platform-native/src/main/java/org/graalvm/junit/platform/NativeImageJUnitLauncher.java +++ b/common/junit-platform-native/src/main/java/org/graalvm/junit/platform/NativeImageJUnitLauncher.java @@ -123,12 +123,12 @@ public static void main(String... args) { out.println("JUnit Platform on Native Image - report"); out.println("----------------------------------------\n"); out.flush(); - launcher.registerTestExecutionListeners(new PrintTestExecutionListener(out)); + configurePrintTestExecutionListener(launcher, out); } SummaryGeneratingListener summaryListener = new SummaryGeneratingListener(); launcher.registerTestExecutionListeners(summaryListener); - launcher.registerTestExecutionListeners(new LegacyXmlReportGeneratingListener(Paths.get(xmlOutput), out)); + configureLegacyXMLReport(launcher, xmlOutput, out); launcher.execute(testPlan); TestExecutionSummary summary = summaryListener.getSummary(); @@ -271,4 +271,21 @@ private static boolean testIdsDirectoryExists(Path directory) { return directory != null && Files.exists(directory); } + + private static void configurePrintTestExecutionListener(Launcher launcher, PrintWriter out) { + try { + Class.forName("org.junit.platform.reporting.legacy.LegacyReportingUtils"); + launcher.registerTestExecutionListeners(new PrintTestExecutionListener(out)); + } catch (NoClassDefFoundError | ClassNotFoundException e) { + // intentionally ignored + } + } + + private static void configureLegacyXMLReport(Launcher launcher, String xmlOutput, PrintWriter out) { + try { + launcher.registerTestExecutionListeners(new LegacyXmlReportGeneratingListener(Paths.get(xmlOutput), out)); + } catch (NoClassDefFoundError e) { + // intentionally ignored + } + } } diff --git a/native-maven-plugin/src/main/java/org/graalvm/buildtools/maven/NativeTestMojo.java b/native-maven-plugin/src/main/java/org/graalvm/buildtools/maven/NativeTestMojo.java index 9b7fc7289..cfa70805b 100644 --- a/native-maven-plugin/src/main/java/org/graalvm/buildtools/maven/NativeTestMojo.java +++ b/native-maven-plugin/src/main/java/org/graalvm/buildtools/maven/NativeTestMojo.java @@ -63,7 +63,13 @@ import org.graalvm.buildtools.utils.FileUtils; import org.graalvm.buildtools.utils.JUnitUtils; import org.graalvm.buildtools.utils.NativeImageConfigurationUtils; +import org.w3c.dom.Document; +import org.xml.sax.SAXException; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import java.io.File; import java.io.IOException; import java.io.UncheckedIOException; import java.nio.file.Files; @@ -135,6 +141,8 @@ protected void addDependenciesToClasspath() throws MojoExecutionException { .filter(it -> it.getGroupId().startsWith(NativeImageConfigurationUtils.MAVEN_GROUP_ID) || it.getGroupId().startsWith("org.junit")) .map(it -> it.getFile().toPath()) .forEach(imageClasspath::add); + + modules.addAll(collectJUnitModulesAlreadyOnClasspath()); var jars = findJunitPlatformNativeJars(modules); imageClasspath.addAll(jars); } @@ -310,6 +318,51 @@ private List findJunitPlatformNativeJars(Set modulesAlreadyOnClass .collect(Collectors.toList()); } + private Set collectJUnitModulesAlreadyOnClasspath() { + Set artifacts = new HashSet<>(); + for (Path entry : imageClasspath) { + if (isJUnitArtifact(entry)) { + File pom = getArtifactPOM(entry); + if (pom != null) { + artifacts.add(getModuleFromPOM(pom)); + } + } + } + + return artifacts; + } + + private boolean isJUnitArtifact(Path entry) { + return entry.toString().contains("junit"); + } + + private File getArtifactPOM(Path classpathEntry) { + List artifactContent = getArtifactContent(classpathEntry.getParent()); + List candidates = artifactContent.stream().filter(f -> f.getName().endsWith(".pom")).collect(Collectors.toList()); + return candidates.size() != 1 ? null : candidates.get(0); + } + + private List getArtifactContent(Path path) { + File[] content = path.toFile().listFiles(); + return content == null ? List.of() : List.of(content); + } + + private Module getModuleFromPOM(File pom) { + try { + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + factory.setIgnoringElementContentWhitespace(true); + DocumentBuilder builder = factory.newDocumentBuilder(); + Document doc = builder.parse(pom); + + String groupId = doc.getElementsByTagName("groupId").item(0).getFirstChild().getTextContent(); + String artifactId = doc.getElementsByTagName("artifactId").item(0).getFirstChild().getTextContent(); + + return new Module(groupId, artifactId); + } catch (ParserConfigurationException | IOException | SAXException e) { + throw new RuntimeException("Cannot get maven coordinates from " + pom.getPath() + ". Reason: " + e.getMessage()); + } + } + private static final class Module { private final String groupId; private final String artifactId; From d80a948c178e0bde77fc355b24a5403a54eac5fc Mon Sep 17 00:00:00 2001 From: David Nestorovic Date: Tue, 13 May 2025 14:53:05 +0200 Subject: [PATCH 2/5] Provide support for earlier JUnit versions without JUnit duplicates on claspath --- .../junit/platform/JUnitPlatformFeature.java | 8 ++- .../config/jupiter/JupiterConfigProvider.java | 10 +++- .../main/resources/initialize-at-buildtime | 4 ++ .../buildtools/maven/NativeTestMojo.java | 55 ------------------- 4 files changed, 19 insertions(+), 58 deletions(-) diff --git a/common/junit-platform-native/src/main/java/org/graalvm/junit/platform/JUnitPlatformFeature.java b/common/junit-platform-native/src/main/java/org/graalvm/junit/platform/JUnitPlatformFeature.java index 5f22314ff..04ad7eb9a 100644 --- a/common/junit-platform-native/src/main/java/org/graalvm/junit/platform/JUnitPlatformFeature.java +++ b/common/junit-platform-native/src/main/java/org/graalvm/junit/platform/JUnitPlatformFeature.java @@ -264,7 +264,13 @@ private static void initializeClassesForJDK21OrEarlier() { try (InputStream is = JUnitPlatformFeature.class.getResourceAsStream("/initialize-at-buildtime")) { if (is != null) { try (BufferedReader br = new BufferedReader(new InputStreamReader(is))) { - br.lines().forEach(RuntimeClassInitialization::initializeAtBuildTime); + br.lines().forEach(cls -> { + try { + RuntimeClassInitialization.initializeAtBuildTime(cls); + } catch (NoClassDefFoundError e) { + // if users use older JUnit versions some classes might not be available + } + }); } } } catch (IOException e) { diff --git a/common/junit-platform-native/src/main/java/org/graalvm/junit/platform/config/jupiter/JupiterConfigProvider.java b/common/junit-platform-native/src/main/java/org/graalvm/junit/platform/config/jupiter/JupiterConfigProvider.java index f666eba56..894099f12 100644 --- a/common/junit-platform-native/src/main/java/org/graalvm/junit/platform/config/jupiter/JupiterConfigProvider.java +++ b/common/junit-platform-native/src/main/java/org/graalvm/junit/platform/config/jupiter/JupiterConfigProvider.java @@ -54,8 +54,8 @@ import org.junit.jupiter.params.converter.ConvertWith; import org.junit.jupiter.params.provider.ArgumentsSource; import org.junit.jupiter.params.provider.EnumSource; -import org.junit.jupiter.params.provider.MethodSource; import org.junit.jupiter.params.provider.FieldSource; +import org.junit.jupiter.params.provider.MethodSource; import java.lang.reflect.Method; import java.util.ArrayList; @@ -86,9 +86,15 @@ public void onTestClassRegistered(Class testClass, NativeImageConfiguration r AnnotationUtils.forEachAnnotatedMethodParameter(testClass, AggregateWith.class, annotation -> registry.registerAllClassMembersForReflection(annotation.value())); AnnotationUtils.forEachAnnotatedMethod(testClass, EnumSource.class, (m, annotation) -> handleEnumSource(m, annotation, registry)); AnnotationUtils.registerClassesFromAnnotationForReflection(testClass, registry, MethodSource.class, JupiterConfigProvider::handleMethodSource); - AnnotationUtils.registerClassesFromAnnotationForReflection(testClass, registry, FieldSource.class, JupiterConfigProvider::handleFieldSource); AnnotationUtils.registerClassesFromAnnotationForReflection(testClass, registry, EnabledIf.class, JupiterConfigProvider::handleEnabledIf); AnnotationUtils.registerClassesFromAnnotationForReflection(testClass, registry, DisabledIf.class, JupiterConfigProvider::handleDisabledIf); + + try { + AnnotationUtils.registerClassesFromAnnotationForReflection(testClass, registry, FieldSource.class, JupiterConfigProvider::handleFieldSource); + } catch (NoClassDefFoundError e) { + // if users use JUnit version older than 5.11, FieldSource class won't be available + } + } private static Class[] handleMethodSource(MethodSource annotation) { diff --git a/common/junit-platform-native/src/main/resources/initialize-at-buildtime b/common/junit-platform-native/src/main/resources/initialize-at-buildtime index 052ceb5f8..0921a7e8b 100644 --- a/common/junit-platform-native/src/main/resources/initialize-at-buildtime +++ b/common/junit-platform-native/src/main/resources/initialize-at-buildtime @@ -46,6 +46,7 @@ org.junit.jupiter.engine.discovery.MethodSelectorResolver$MethodType$3 org.junit.jupiter.engine.discovery.predicates.IsTestClassWithTests org.junit.jupiter.engine.discovery.predicates.IsTestFactoryMethod org.junit.jupiter.engine.execution.ConditionEvaluator +org.junit.jupiter.engine.execution.ExecutableInvoker org.junit.jupiter.engine.execution.InterceptingExecutableInvoker org.junit.jupiter.engine.execution.InterceptingExecutableInvoker$ReflectiveInterceptorCall org.junit.jupiter.engine.execution.InterceptingExecutableInvoker$ReflectiveInterceptorCall$VoidMethodInterceptorCall @@ -78,6 +79,7 @@ org.junit.platform.launcher.core.DiscoveryIssueNotifier org.junit.platform.launcher.core.EngineDiscoveryOrchestrator org.junit.platform.launcher.core.EngineExecutionOrchestrator org.junit.platform.launcher.core.EngineFilterer +org.junit.platform.launcher.core.EngineIdValidator org.junit.platform.launcher.core.HierarchicalOutputDirectoryProvider org.junit.platform.launcher.core.InternalTestPlan org.junit.platform.launcher.core.LauncherConfig @@ -90,6 +92,8 @@ org.junit.platform.launcher.core.LauncherDiscoveryResult org.junit.platform.launcher.core.LauncherDiscoveryResult$EngineResultInfo org.junit.platform.launcher.core.LauncherListenerRegistry org.junit.platform.launcher.core.ListenerRegistry +org.junit.platform.launcher.core.ServiceLoaderRegistry +org.junit.platform.launcher.core.ServiceLoaderTestEngineRegistry org.junit.platform.launcher.core.SessionPerRequestLauncher org.junit.platform.launcher.EngineDiscoveryResult org.junit.platform.launcher.LauncherSessionListener$1 diff --git a/native-maven-plugin/src/main/java/org/graalvm/buildtools/maven/NativeTestMojo.java b/native-maven-plugin/src/main/java/org/graalvm/buildtools/maven/NativeTestMojo.java index cfa70805b..dec5ebbdb 100644 --- a/native-maven-plugin/src/main/java/org/graalvm/buildtools/maven/NativeTestMojo.java +++ b/native-maven-plugin/src/main/java/org/graalvm/buildtools/maven/NativeTestMojo.java @@ -60,16 +60,9 @@ import org.eclipse.aether.resolution.DependencyRequest; import org.eclipse.aether.resolution.DependencyResolutionException; import org.eclipse.aether.resolution.DependencyResult; -import org.graalvm.buildtools.utils.FileUtils; import org.graalvm.buildtools.utils.JUnitUtils; import org.graalvm.buildtools.utils.NativeImageConfigurationUtils; -import org.w3c.dom.Document; -import org.xml.sax.SAXException; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import java.io.File; import java.io.IOException; import java.io.UncheckedIOException; import java.nio.file.Files; @@ -82,7 +75,6 @@ import java.util.HashSet; import java.util.List; import java.util.Set; -import java.util.regex.Pattern; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -141,8 +133,6 @@ protected void addDependenciesToClasspath() throws MojoExecutionException { .filter(it -> it.getGroupId().startsWith(NativeImageConfigurationUtils.MAVEN_GROUP_ID) || it.getGroupId().startsWith("org.junit")) .map(it -> it.getFile().toPath()) .forEach(imageClasspath::add); - - modules.addAll(collectJUnitModulesAlreadyOnClasspath()); var jars = findJunitPlatformNativeJars(modules); imageClasspath.addAll(jars); } @@ -318,51 +308,6 @@ private List findJunitPlatformNativeJars(Set modulesAlreadyOnClass .collect(Collectors.toList()); } - private Set collectJUnitModulesAlreadyOnClasspath() { - Set artifacts = new HashSet<>(); - for (Path entry : imageClasspath) { - if (isJUnitArtifact(entry)) { - File pom = getArtifactPOM(entry); - if (pom != null) { - artifacts.add(getModuleFromPOM(pom)); - } - } - } - - return artifacts; - } - - private boolean isJUnitArtifact(Path entry) { - return entry.toString().contains("junit"); - } - - private File getArtifactPOM(Path classpathEntry) { - List artifactContent = getArtifactContent(classpathEntry.getParent()); - List candidates = artifactContent.stream().filter(f -> f.getName().endsWith(".pom")).collect(Collectors.toList()); - return candidates.size() != 1 ? null : candidates.get(0); - } - - private List getArtifactContent(Path path) { - File[] content = path.toFile().listFiles(); - return content == null ? List.of() : List.of(content); - } - - private Module getModuleFromPOM(File pom) { - try { - DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); - factory.setIgnoringElementContentWhitespace(true); - DocumentBuilder builder = factory.newDocumentBuilder(); - Document doc = builder.parse(pom); - - String groupId = doc.getElementsByTagName("groupId").item(0).getFirstChild().getTextContent(); - String artifactId = doc.getElementsByTagName("artifactId").item(0).getFirstChild().getTextContent(); - - return new Module(groupId, artifactId); - } catch (ParserConfigurationException | IOException | SAXException e) { - throw new RuntimeException("Cannot get maven coordinates from " + pom.getPath() + ". Reason: " + e.getMessage()); - } - } - private static final class Module { private final String groupId; private final String artifactId; From 8a21b4036a8e14b9cbc9c920634cb0af787641bd Mon Sep 17 00:00:00 2001 From: David Nestorovic Date: Tue, 13 May 2025 19:13:22 +0200 Subject: [PATCH 3/5] Add missing dependencies to gradle samples --- samples/java-application-with-custom-tests/build.gradle | 2 ++ samples/java-application-with-reflection/build.gradle | 1 + samples/java-application-with-resources/build.gradle | 1 + samples/java-application-with-tests/build.gradle | 2 ++ samples/java-library/build.gradle | 1 + samples/junit-tests/build.gradle | 1 + samples/kotlin-application-with-tests/build.gradle | 1 + samples/multi-project-with-tests/core/build.gradle | 1 + 8 files changed, 10 insertions(+) diff --git a/samples/java-application-with-custom-tests/build.gradle b/samples/java-application-with-custom-tests/build.gradle index c6e4a8fbe..848659b3f 100644 --- a/samples/java-application-with-custom-tests/build.gradle +++ b/samples/java-application-with-custom-tests/build.gradle @@ -68,6 +68,8 @@ dependencies { testImplementation(platform("org.junit:junit-bom:${junitVersion}")) testImplementation('org.junit.jupiter:junit-jupiter') integTestImplementation project(":") + testRuntimeOnly("org.junit.platform:junit-platform-launcher:1.11.0") + testRuntimeOnly("org.junit.platform:junit-platform-reporting:1.11.0") } def integTest = tasks.register("integTest", Test) { diff --git a/samples/java-application-with-reflection/build.gradle b/samples/java-application-with-reflection/build.gradle index a13580cb8..d20401f55 100644 --- a/samples/java-application-with-reflection/build.gradle +++ b/samples/java-application-with-reflection/build.gradle @@ -58,6 +58,7 @@ def junitVersion = providers.gradleProperty('junit.jupiter.version') dependencies { testImplementation(platform("org.junit:junit-bom:${junitVersion}")) testImplementation('org.junit.jupiter:junit-jupiter') + testRuntimeOnly("org.junit.platform:junit-platform-launcher:1.11.0") } test { diff --git a/samples/java-application-with-resources/build.gradle b/samples/java-application-with-resources/build.gradle index b8b2ca6f8..d01b883df 100644 --- a/samples/java-application-with-resources/build.gradle +++ b/samples/java-application-with-resources/build.gradle @@ -58,6 +58,7 @@ def junitVersion = providers.gradleProperty('junit.jupiter.version') dependencies { testImplementation(platform("org.junit:junit-bom:${junitVersion}")) testImplementation('org.junit.jupiter:junit-jupiter') + testRuntimeOnly("org.junit.platform:junit-platform-launcher:1.11.0") } test { diff --git a/samples/java-application-with-tests/build.gradle b/samples/java-application-with-tests/build.gradle index 4be9055f5..2f7cf9d2e 100644 --- a/samples/java-application-with-tests/build.gradle +++ b/samples/java-application-with-tests/build.gradle @@ -58,6 +58,8 @@ def junitVersion = providers.gradleProperty('junit.jupiter.version') dependencies { testImplementation(platform("org.junit:junit-bom:${junitVersion}")) testImplementation('org.junit.jupiter:junit-jupiter') + testRuntimeOnly("org.junit.platform:junit-platform-launcher:1.11.0") + testRuntimeOnly("org.junit.platform:junit-platform-reporting:1.11.0") } test { diff --git a/samples/java-library/build.gradle b/samples/java-library/build.gradle index 0b9c4d818..3689f9abb 100644 --- a/samples/java-library/build.gradle +++ b/samples/java-library/build.gradle @@ -54,6 +54,7 @@ def junitVersion = providers.gradleProperty('junit.jupiter.version') dependencies { testImplementation(platform("org.junit:junit-bom:${junitVersion}")) testImplementation('org.junit.jupiter:junit-jupiter') + testRuntimeOnly("org.junit.platform:junit-platform-launcher:1.11.0") } graalvmNative { diff --git a/samples/junit-tests/build.gradle b/samples/junit-tests/build.gradle index 0e5021ca1..6a2e1b659 100644 --- a/samples/junit-tests/build.gradle +++ b/samples/junit-tests/build.gradle @@ -51,6 +51,7 @@ repositories { dependencies { testImplementation 'org.junit.jupiter:junit-jupiter:5.11.0' testImplementation "org.junit.vintage:junit-vintage-engine:5.11.0" + testRuntimeOnly("org.junit.platform:junit-platform-launcher:1.11.0") } application { diff --git a/samples/kotlin-application-with-tests/build.gradle b/samples/kotlin-application-with-tests/build.gradle index e69823512..7f15d100d 100644 --- a/samples/kotlin-application-with-tests/build.gradle +++ b/samples/kotlin-application-with-tests/build.gradle @@ -54,6 +54,7 @@ dependencies { implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8' testImplementation 'org.jetbrains.kotlin:kotlin-test' + testRuntimeOnly("org.junit.platform:junit-platform-launcher:1.11.0") } application { diff --git a/samples/multi-project-with-tests/core/build.gradle b/samples/multi-project-with-tests/core/build.gradle index 64c80da81..1973ae20a 100644 --- a/samples/multi-project-with-tests/core/build.gradle +++ b/samples/multi-project-with-tests/core/build.gradle @@ -59,6 +59,7 @@ dependencies { implementation(project(":utils")) testImplementation(platform("org.junit:junit-bom:${junitVersion}")) testImplementation('org.junit.jupiter:junit-jupiter') + testRuntimeOnly("org.junit.platform:junit-platform-launcher:1.11.0") } test { From 24556e1ee1cd4df7aead58a49a051f58796d6217 Mon Sep 17 00:00:00 2001 From: David Nestorovic Date: Wed, 14 May 2025 01:25:22 +0200 Subject: [PATCH 4/5] Add missing dependencies to maven samples --- native-maven-plugin/reproducers/issue-144/pom.xml | 6 ++++++ samples/java-application-with-reflection/pom.xml | 6 ++++++ samples/java-application-with-resources/pom.xml | 6 ++++++ samples/java-application-with-tests/pom.xml | 6 ++++++ samples/java-library/pom.xml | 6 ++++++ samples/junit-tests/pom.xml | 6 ++++++ samples/multi-project-with-tests/pom.xml | 6 ++++++ 7 files changed, 42 insertions(+) diff --git a/native-maven-plugin/reproducers/issue-144/pom.xml b/native-maven-plugin/reproducers/issue-144/pom.xml index a64e06846..ea844b8a1 100644 --- a/native-maven-plugin/reproducers/issue-144/pom.xml +++ b/native-maven-plugin/reproducers/issue-144/pom.xml @@ -69,6 +69,12 @@ ${junit.jupiter.version} test + + org.junit.platform + junit-platform-launcher + 1.11.0 + test + diff --git a/samples/java-application-with-reflection/pom.xml b/samples/java-application-with-reflection/pom.xml index c68d4e8a9..338255ce4 100644 --- a/samples/java-application-with-reflection/pom.xml +++ b/samples/java-application-with-reflection/pom.xml @@ -65,6 +65,12 @@ ${junit.jupiter.version} test + + org.junit.platform + junit-platform-launcher + 1.11.0 + test + diff --git a/samples/java-application-with-resources/pom.xml b/samples/java-application-with-resources/pom.xml index 95fd47f4c..8e8e6afc6 100644 --- a/samples/java-application-with-resources/pom.xml +++ b/samples/java-application-with-resources/pom.xml @@ -70,6 +70,12 @@ ${junit.jupiter.version} test + + org.junit.platform + junit-platform-launcher + 1.11.0 + test + diff --git a/samples/java-application-with-tests/pom.xml b/samples/java-application-with-tests/pom.xml index 19b088af7..02b17befd 100644 --- a/samples/java-application-with-tests/pom.xml +++ b/samples/java-application-with-tests/pom.xml @@ -71,6 +71,12 @@ ${junit.jupiter.version} test + + org.junit.platform + junit-platform-launcher + 1.11.0 + test + diff --git a/samples/java-library/pom.xml b/samples/java-library/pom.xml index 52acbb800..644b989d2 100644 --- a/samples/java-library/pom.xml +++ b/samples/java-library/pom.xml @@ -63,6 +63,12 @@ ${junit.jupiter.version} test + + org.junit.platform + junit-platform-launcher + 1.11.0 + test + diff --git a/samples/junit-tests/pom.xml b/samples/junit-tests/pom.xml index 9cdc96369..54b5e5583 100644 --- a/samples/junit-tests/pom.xml +++ b/samples/junit-tests/pom.xml @@ -64,6 +64,12 @@ ${junit.jupiter.version} test + + org.junit.platform + junit-platform-launcher + 1.11.0 + test + org.junit.vintage junit-vintage-engine diff --git a/samples/multi-project-with-tests/pom.xml b/samples/multi-project-with-tests/pom.xml index 1ef97757b..836f1d837 100644 --- a/samples/multi-project-with-tests/pom.xml +++ b/samples/multi-project-with-tests/pom.xml @@ -71,6 +71,12 @@ ${junit.jupiter.version} test + + org.junit.platform + junit-platform-launcher + 1.11.0 + test + From 99c40a94ac31d36f706a12f78bf7fc96ee936556 Mon Sep 17 00:00:00 2001 From: David Nestorovic Date: Wed, 14 May 2025 15:12:28 +0200 Subject: [PATCH 5/5] Fix kotlin tests on gradle --- samples/kotlin-application-with-tests/build.gradle | 3 +++ 1 file changed, 3 insertions(+) diff --git a/samples/kotlin-application-with-tests/build.gradle b/samples/kotlin-application-with-tests/build.gradle index 7f15d100d..3fd93ea08 100644 --- a/samples/kotlin-application-with-tests/build.gradle +++ b/samples/kotlin-application-with-tests/build.gradle @@ -54,7 +54,10 @@ dependencies { implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8' testImplementation 'org.jetbrains.kotlin:kotlin-test' + testRuntimeOnly(platform("org.junit:junit-bom:5.11.0")) + testRuntimeOnly("org.junit.platform:junit-platform-console:1.11.0") testRuntimeOnly("org.junit.platform:junit-platform-launcher:1.11.0") + testRuntimeOnly("org.junit.jupiter:junit-jupiter") } application {