diff --git a/plugin/src/main/java/org/gradle/testretry/TestRetryPlugin.java b/plugin/src/main/java/org/gradle/testretry/TestRetryPlugin.java index 94c390b1..5e3a26d0 100644 --- a/plugin/src/main/java/org/gradle/testretry/TestRetryPlugin.java +++ b/plugin/src/main/java/org/gradle/testretry/TestRetryPlugin.java @@ -39,9 +39,16 @@ public class TestRetryPlugin implements Plugin { @Override public void apply(Project project) { + if (pluginAlreadyApplied(project)) { + return; + } + project.getTasks() .withType(Test.class) .configureEach(task -> configureTestTask(task, objectFactory, providerFactory)); } + private static boolean pluginAlreadyApplied(Project project) { + return project.getPlugins().stream().anyMatch(plugin -> plugin.getClass().getName().equals(TestRetryPlugin.class.getName())); + } }