Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build.gradle: Clear Class-Path from shadowJar manifest #9270

Merged
merged 1 commit into from Jun 15, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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