diff --git a/buildSrc/src/main/java/org/springframework/boot/build/test/SystemTestPlugin.java b/buildSrc/src/main/java/org/springframework/boot/build/test/SystemTestPlugin.java index e0352bbf02..634e110a69 100644 --- a/buildSrc/src/main/java/org/springframework/boot/build/test/SystemTestPlugin.java +++ b/buildSrc/src/main/java/org/springframework/boot/build/test/SystemTestPlugin.java @@ -18,8 +18,10 @@ package org.springframework.boot.build.test; import org.gradle.api.Plugin; import org.gradle.api.Project; +import org.gradle.api.Task; import org.gradle.api.plugins.JavaPlugin; import org.gradle.api.plugins.JavaPluginConvention; +import org.gradle.api.specs.Spec; import org.gradle.api.tasks.SourceSet; import org.gradle.api.tasks.SourceSetContainer; import org.gradle.api.tasks.testing.Test; @@ -35,6 +37,8 @@ import org.gradle.plugins.ide.eclipse.model.EclipseModel; */ public class SystemTestPlugin implements Plugin { + private static final Spec NEVER = (task) -> false; + /** * Name of the {@code systemTest} task. */ @@ -78,6 +82,13 @@ public class SystemTestPlugin implements Plugin { systemTest.setTestClassesDirs(systemTestSourceSet.getOutput().getClassesDirs()); systemTest.setClasspath(systemTestSourceSet.getRuntimeClasspath()); systemTest.shouldRunAfter(JavaPlugin.TEST_TASK_NAME); + if (isCi()) { + systemTest.getOutputs().upToDateWhen(NEVER); + } + } + + private boolean isCi() { + return Boolean.parseBoolean(System.getenv("CI")); } } diff --git a/ci/scripts/run-system-tests.sh b/ci/scripts/run-system-tests.sh index 4cb3025da6..c03ce1e823 100755 --- a/ci/scripts/run-system-tests.sh +++ b/ci/scripts/run-system-tests.sh @@ -5,8 +5,8 @@ source $(dirname $0)/common.sh pushd git-repo > /dev/null if [[ -d /opt/openjdk-toolchain ]]; then - ./gradlew -Dorg.gradle.internal.launcher.welcomeMessageEnabled=false --no-daemon --max-workers=4 --rerun-tasks systemTest -PtoolchainVersion=${TOOLCHAIN_JAVA_VERSION} -Porg.gradle.java.installations.auto-detect=false -Porg.gradle.java.installations.auto-download=false -Porg.gradle.java.installations.paths=/opt/openjdk-toolchain/ + ./gradlew -Dorg.gradle.internal.launcher.welcomeMessageEnabled=false --no-daemon --max-workers=4 systemTest -PtoolchainVersion=${TOOLCHAIN_JAVA_VERSION} -Porg.gradle.java.installations.auto-detect=false -Porg.gradle.java.installations.auto-download=false -Porg.gradle.java.installations.paths=/opt/openjdk-toolchain/ else - ./gradlew -Dorg.gradle.internal.launcher.welcomeMessageEnabled=false --no-daemon --max-workers=4 --rerun-tasks systemTest + ./gradlew -Dorg.gradle.internal.launcher.welcomeMessageEnabled=false --no-daemon --max-workers=4 systemTest fi popd > /dev/null