DependencyDownload icon indicating copy to clipboard operation
DependencyDownload copied to clipboard

ShadowJar support (for auto gathering relocations) possibly being removed

Open Vankka opened this issue 2 years ago • 0 comments

Support for taking relocations directly from shadowJar into the dependency files generated by the Gradle plugin (via the includeShadowJarRelocations option) might be removed in the future.

Doing it requires doing reflection to access the relocations, is unreliable and only seems to be becoming more unreliable in the most recent Gradle versions.

The recommended replacement is doing something like this:

[
    'org.apache.commons',
    'com.google.gson'
].each {
    var relocated = 'com.example.myapp.dependencies.' + it
    tasks.shadowJar.relocate it, relocated
    tasks.generateRuntimeDownloadResourceForRuntimeDownloadOnly.relocate it, relocated
}

Vankka avatar May 11 '23 18:05 Vankka