diff --git a/dependency-guard/src/main/kotlin/com/dropbox/gradle/plugins/dependencyguard/DependencyGuardPlugin.kt b/dependency-guard/src/main/kotlin/com/dropbox/gradle/plugins/dependencyguard/DependencyGuardPlugin.kt index 6272db8..e79dc81 100644 --- a/dependency-guard/src/main/kotlin/com/dropbox/gradle/plugins/dependencyguard/DependencyGuardPlugin.kt +++ b/dependency-guard/src/main/kotlin/com/dropbox/gradle/plugins/dependencyguard/DependencyGuardPlugin.kt @@ -46,12 +46,12 @@ public class DependencyGuardPlugin : Plugin { } private fun attachToCheckTask(target: Project, dependencyGuardTask: TaskProvider) { - // Required to add the "check" lifecycle task - target.plugins.apply(LifecycleBasePlugin::class.java) - - // Attach the "dependencyGuard" task to the "check" lifecycle task - target.tasks.named(LifecycleBasePlugin.CHECK_TASK_NAME).configure { - this.dependsOn(dependencyGuardTask) + // Only add to the "check" lifecycle task if the base plugin is applied + target.pluginManager.withPlugin("base") { + // Attach the "dependencyGuard" task to the "check" lifecycle task + target.tasks.named(LifecycleBasePlugin.CHECK_TASK_NAME).configure { + this.dependsOn(dependencyGuardTask) + } } }