Skip to content

Commit aa63070

Browse files
Apply test conventions unconditionally
See gh-21272
1 parent 8ec16bd commit aa63070

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

buildSrc/src/main/java/org/springframework/boot/build/JavaConventions.java

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -107,18 +107,19 @@ private void configureJarManifestConventions(Project project) {
107107
}
108108

109109
private void configureTestConventions(Project project) {
110-
if (Boolean.valueOf(System.getenv("CI"))) {
110+
project.getTasks().withType(Test.class, (test) -> {
111+
withOptionalBuildJavaHome(project, (javaHome) -> test.setExecutable(javaHome + "/bin/java"));
112+
test.useJUnitPlatform();
113+
test.setMaxHeapSize("1024M");
114+
});
115+
if (Boolean.parseBoolean(System.getenv("CI"))) {
111116
project.getPlugins().apply(TestRetryPlugin.class);
112-
project.getTasks().withType(Test.class, (test) -> {
113-
withOptionalBuildJavaHome(project, (javaHome) -> test.setExecutable(javaHome + "/bin/java"));
114-
test.useJUnitPlatform();
115-
test.setMaxHeapSize("1024M");
116-
project.getPlugins().withType(TestRetryPlugin.class, (testRetryPlugin) -> {
117-
TestRetryTaskExtension testRetry = test.getExtensions().getByType(TestRetryTaskExtension.class);
118-
testRetry.getFailOnPassedAfterRetry().set(true);
119-
testRetry.getMaxRetries().set(3);
120-
});
121-
});
117+
project.getTasks().withType(Test.class,
118+
(test) -> project.getPlugins().withType(TestRetryPlugin.class, (testRetryPlugin) -> {
119+
TestRetryTaskExtension testRetry = test.getExtensions().getByType(TestRetryTaskExtension.class);
120+
testRetry.getFailOnPassedAfterRetry().set(true);
121+
testRetry.getMaxRetries().set(3);
122+
}));
122123
}
123124
}
124125

0 commit comments

Comments
 (0)