From aa63070fb9e3b1af522122725333fe961412cda3 Mon Sep 17 00:00:00 2001 From: Scott Frederick Date: Thu, 30 Apr 2020 16:32:48 -0500 Subject: [PATCH] Apply test conventions unconditionally See gh-21272 --- .../boot/build/JavaConventions.java | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/buildSrc/src/main/java/org/springframework/boot/build/JavaConventions.java b/buildSrc/src/main/java/org/springframework/boot/build/JavaConventions.java index 883a8f10a1..6402eafe3f 100644 --- a/buildSrc/src/main/java/org/springframework/boot/build/JavaConventions.java +++ b/buildSrc/src/main/java/org/springframework/boot/build/JavaConventions.java @@ -107,18 +107,19 @@ class JavaConventions { } private void configureTestConventions(Project project) { - if (Boolean.valueOf(System.getenv("CI"))) { + project.getTasks().withType(Test.class, (test) -> { + withOptionalBuildJavaHome(project, (javaHome) -> test.setExecutable(javaHome + "/bin/java")); + test.useJUnitPlatform(); + test.setMaxHeapSize("1024M"); + }); + if (Boolean.parseBoolean(System.getenv("CI"))) { project.getPlugins().apply(TestRetryPlugin.class); - project.getTasks().withType(Test.class, (test) -> { - withOptionalBuildJavaHome(project, (javaHome) -> test.setExecutable(javaHome + "/bin/java")); - test.useJUnitPlatform(); - test.setMaxHeapSize("1024M"); - project.getPlugins().withType(TestRetryPlugin.class, (testRetryPlugin) -> { - TestRetryTaskExtension testRetry = test.getExtensions().getByType(TestRetryTaskExtension.class); - testRetry.getFailOnPassedAfterRetry().set(true); - testRetry.getMaxRetries().set(3); - }); - }); + project.getTasks().withType(Test.class, + (test) -> project.getPlugins().withType(TestRetryPlugin.class, (testRetryPlugin) -> { + TestRetryTaskExtension testRetry = test.getExtensions().getByType(TestRetryTaskExtension.class); + testRetry.getFailOnPassedAfterRetry().set(true); + testRetry.getMaxRetries().set(3); + })); } }