Skip to content

Commit

Permalink
build.gradle: Clear Class-Path from shadowJar manifest
Browse files Browse the repository at this point in the history
Fixes #8606
  • Loading branch information
ejona86 committed Jun 13, 2022
1 parent a738bc8 commit a77bc21
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions build.gradle
Expand Up @@ -369,6 +369,24 @@ subprojects {
}
}

plugins.withId("com.github.johnrengelman.shadow") {
tasks.named("shadowJar") {
// Do a dance to remove Class-Path. This needs to run after the doFirst() from the
// shadow plugin that adds Class-Path and before the core jar action. Using doFirst will
// have this run before the shadow plugin, and doLast will run after the core jar
// action. See #8606.
// The shadow plugin adds another doFirst when application is used for setting
// Main-Class. Ordering with it doesn't matter.
actions.add(plugins.hasPlugin("application") ? 2 : 1, new Action<Task>() {
@Override public void execute(Task task) {
if (!task.manifest.attributes.remove("Class-Path")) {
throw new AssertionError("Did not find Class-Path to remove from manifest")
}
}
})
}
}

plugins.withId("maven-publish") {
publishing {
publications {
Expand Down

0 comments on commit a77bc21

Please sign in to comment.