From 2f94a2558023b208ffb840471281703cb2c9b222 Mon Sep 17 00:00:00 2001 From: Michael Juliano Date: Mon, 24 May 2021 16:39:42 -0400 Subject: [PATCH] Moved graldeApi() exclusion to the task configuration. --- .../gradle/plugins/shadow/ShadowJavaPlugin.groovy | 3 +++ .../jengelman/gradle/plugins/shadow/ShadowPlugin.groovy | 9 --------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/main/groovy/com/github/jengelman/gradle/plugins/shadow/ShadowJavaPlugin.groovy b/src/main/groovy/com/github/jengelman/gradle/plugins/shadow/ShadowJavaPlugin.groovy index 670683700..727cbb9f3 100644 --- a/src/main/groovy/com/github/jengelman/gradle/plugins/shadow/ShadowJavaPlugin.groovy +++ b/src/main/groovy/com/github/jengelman/gradle/plugins/shadow/ShadowJavaPlugin.groovy @@ -87,6 +87,9 @@ class ShadowJavaPlugin implements Plugin { shadow.configurations = [project.configurations.findByName('runtimeClasspath') ? project.configurations.runtimeClasspath : project.configurations.runtime] shadow.exclude('META-INF/INDEX.LIST', 'META-INF/*.SF', 'META-INF/*.DSA', 'META-INF/*.RSA', 'module-info.class') + shadow.dependencies { + exclude(dependency(project.dependencies.gradleApi())) + } } project.artifacts.add(ShadowBasePlugin.CONFIGURATION_NAME, project.tasks.named(SHADOW_JAR_TASK_NAME)) configureShadowUpload() diff --git a/src/main/groovy/com/github/jengelman/gradle/plugins/shadow/ShadowPlugin.groovy b/src/main/groovy/com/github/jengelman/gradle/plugins/shadow/ShadowPlugin.groovy index 6865ef8bd..1191afc94 100644 --- a/src/main/groovy/com/github/jengelman/gradle/plugins/shadow/ShadowPlugin.groovy +++ b/src/main/groovy/com/github/jengelman/gradle/plugins/shadow/ShadowPlugin.groovy @@ -34,15 +34,6 @@ class ShadowPlugin implements Plugin { } } } - - afterEvaluate { - plugins.withId('java-gradle-plugin') { - // needed to prevent inclusion of gradle-api into shadow JAR - configurations.named(JavaPlugin.API_CONFIGURATION_NAME) { - dependencies.remove(project.dependencies.gradleApi()) - } - } - } } } }