Is there a way to shadow a particular (transitive) dependency in Gradle? My situation: I have a project that depends directly on com.amazonaws:aws-java-sdk-emr:1.10.33
and org.apache.hadoop:hadoop-aws:2.7.1
, but hadoop-aws
in turns depends on com.amazonaws:aws-java-sdk-emr:1.7.4
which screws the final JAR, but I need both anyway.
Is it currently possible to do something like this?
shadowJar {
relocate('com.amazonaws', 'shadowedstuff.awsjdk') {
include(dependency('com.amazonaws:aws-java-sdk:1.7.4'))
}
}
Or a not-so-dirty workaround for it?
Thanks!
NOTE: shading the aws-sdk
which my projects depends on directly is not an option. This is a simplification and in the original setup some reflection is going on.
Yes, you can use the shadow plugin for Gradle to which has a very similar syntax to your example:
// Configuring Filtering for Relocation
shadowJar {
relocate('junit.textui', 'a') {
exclude 'junit.textui.TestRunner'
}
relocate('junit.framework', 'b') {
include 'junit.framework.Test*'
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With