Open furrowb opened 7 years ago
Here's an example screenshot of it relocating the string being referenced in a class, even though the classes themselves have been excluded.
@furrowb I also had this problem, but was able to get it working by specifying the package using slashes instead of periods.
relocate ("org.apache", "shaded.org.apache") {
exclude "org/apache/logging/**"
}
@furrowb I also had this problem, but was able to get it working by specifying the package using slashes instead of periods.
relocate ("org.apache", "shaded.org.apache") { exclude "org/apache/logging/**" }
That solution doesn't seem to work anymore. I'm excluding a package from relocation and a class inside the excluded package which has a string value referencing a resource inside the excluded package ends up with the string "relocated".
@furrowb I also had this problem, but was able to get it working by specifying the package using slashes instead of periods.
relocate ("org.apache", "shaded.org.apache") { exclude "org/apache/logging/**" }
Thanks, this finally worked for me.
Not working:
<relocation>
<pattern>io.grpc</pattern>
<shadedPattern>my.prefix.io.grpc</shadedPattern>
<excludes>
<exclude>io.grpc.netty.*</exclude>
</excludes>
</relocation>
Working:
<relocation>
<pattern>io.grpc</pattern>
<shadedPattern>my.prefix.io.grpc</shadedPattern>
<excludes>
<exclude>io/grpc/netty/**</exclude>
</excludes>
</relocation>
This is on maven-shade-plugin:3.5.1
. They really need to update their docs.
I was creating a Gradle plugin to help standardize some of our build processes and when we started using exclude for relocates, we noticed some issues. By default, we are relocating
com
andorg
based projects but needed some exclusions.When specifying excludes for relocates using
org.apache.cxf*/**
, this excluded the jar with the related class files in question from being relocated. However, it does NOT exclude relocating references in other jars.The library this affected was
compile (group: 'io.cloudsoft.windows', name: 'winrm4j', version: '0.5.0' )
, which was also being excluded. I had the jar instead of the maven dependency oforg.apache.cxf
but it was version3.1.10
. Decompiling the jar showed that the jar had its references toorg.apache.cnf
relocated to our given relocation path,com/new/path/org.apache.cnf.ClassFile
(note the slashes).Shadow Version
2.0.0
Gradle Version
3.5
Expected Behavior
Excluding
org.apache.cxf*/**
from a relocate excludes any relocation from happening for this classpath.Actual Behavior
Excluding
org.apache.cxf*/**
from a relocate excludes the classes from being relocated but still relocates string references.Gradle Build Script(s)
No script since this is was a Gradle plugin, written in a Groovy project.
Content of Shadow JAR (
jar tf <jar file>
- post link to GIST if too long)https://gist.github.com/furrowb/923f30596eb0c4f563a6f750e5bb2cdc