Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to include only project and relocated classes when using Gradle Shadow plugin?

I have the following:

shadowJar {
    relocate 'com.google.common', 'com.example.com.google.common'
}

which produces '-all.jar' files with all of the module's dependencies.

shadowJar {
    relocate 'com.google.common', 'com.example.com.google.common'

    dependencies {
        include('com.example.com.google.common')
    }
}

and:

shadowJar {
    relocate 'com.google.common', 'com.example.com.google.common'

    dependencies {
        include(dependency('com.google.guava:guava:14+'))
    }
}

both produce '-all.jar' files with absolutely no classes.

How do I go about creating the '-all.jar' files that includes only the project's classes and the relocated classes?

like image 413
Noel Yap Avatar asked Nov 10 '22 00:11

Noel Yap


1 Answers

You need to specify guava in the shadow configuration. For example:

dependencies {
    shadow 'com.google.guava:guava:14+'
}
like image 53
Noel Yap Avatar answered Jan 04 '23 03:01

Noel Yap