0

As I can see ConfigureShadowRelocation task does not support excludes. ShadowJar task does not support patterns in relocate method. I use version 7.1.2.

Is there a way to do a bulk relocation with excludes? Maybe I missed something.

UPD: Here is an example:

import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar

plugins {
    id("com.github.johnrengelman.shadow") version "7.1.2"
}

dependencies {
    implementation(project(":lib-b"))

    implementation("com.squareup.okhttp3:okhttp:4.10.0")
}

tasks.withType<ShadowJar> {
    archiveClassifier.set("")
    relocate("my.example", "shaded.example") {
        exclude("my.example.api.*")
    }
    relocate("okhttp3", "shaded.okhttp3")
    relocate("com.fasterxml.jackson", "shaded.jackson")
}

In the example lib-b brings the only transitive dependency com.fasterxml.jackson. But in a real scenario there might be lots of them. I wonder if there is a way not to specify them all in relocate method.

  • Please provide [minimal, reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) of what you are trying to achieve. – Cisco May 07 '23 at 03:14

0 Answers0