Snippet to apply retry plugin to all projects only supporting Junit5 platform
plugins {
id " org.gradle.test-retry" version " 1.4.0" apply false
}
def isCiServer = System . getenv(). containsKey(" CI" )
gradle. beforeProject { p ->
p. pluginManager. withPlugin(" java" ) {
p. apply(plugin : " org.gradle.test-retry" )
p. tasks. withType(Test ). configureEach {
if (testFramework instanceof org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestFramework ) {
retry {
if (isCiServer) {
maxRetries. set(1 )
maxFailures. set(5 )
}
failOnPassedAfterRetry. set(true )
}
}
}
}
}
plugins {
id(" org.gradle.test-retry" ) version(" 1.4.0" ) apply (false )
}
val isCiServer = System .getenv().containsKey(" CI" )
gradle.beforeProject {
pluginManager.withPlugin(" java" ) {
apply (plugin = " org.gradle.test-retry" )
tasks.withType<Test >().configureEach {
if (testFramework is org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestFramework ) {
retry {
if (isCiServer) {
maxRetries.set(1 )
maxFailures.set(5 )
}
failOnPassedAfterRetry.set(true )
}
}
}
}
}
Could you update the test retry version in this snippet to 1.4.0?
Does this work without the
beforeProject
?