# Shadow plugin and multi-release jars

**URL:** <https://discuss.gradle.org/t/shadow-plugin-and-multi-release-jars/27753>\
**Category:** Help/Discuss\
**Created:** [July 17, 2018, 1:05am UTC](https://discuss.gradle.org/t/shadow-plugin-and-multi-release-jars/27753 "2018-07-17T01:05:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tmcf](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/tmcf/32/6571_2.png) [@tmcf](https://discuss.gradle.org/u/tmcf)\
**Post date:** [July 17, 2018, 1:05am UTC](https://discuss.gradle.org/t/shadow-plugin-and-multi-release-jars/27753/1 "2018-07-17T01:05:40Z")

</div>

Hi,  
I’ve been using the gradle shadow plugin to shade some lucene 7 dependencies, which are multi-release jars, doing something along the lines of relocating ‘org.apache.lucene’ to ‘shadow.org.apache.lucene7’.

This has been working fine while I’ve been using Java 8, as the META-INF/versions class files are not used. Now that I’m migrating to Java 9 and 10, I am having trouble with the Java version specific class files located under META-INF/versions which are not being relocated.

I can’t work out how to get the shadow plugin to relocate the class files under META-INF/versions.

Any pointers on how this might be done?

Thanks,

Ted

---

<div class="post-metadata">

**Author:** ![tmcf](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/tmcf/32/6571_2.png) [@tmcf](https://discuss.gradle.org/u/tmcf)\
**Post date:** [July 17, 2018, 7:06am UTC](https://discuss.gradle.org/t/shadow-plugin-and-multi-release-jars/27753/2 "2018-07-17T07:06:57Z")

</div>

Just to clarify, the release specific class files themselves under META-INF/versions appear to be correctly relocated, but the enclosing path hierarchy is not, so for example, for the Java 9 specific class:

- org.apache.lucene.util.CharsRef, the Java 9 version in the original lucene jar is located at;
- META-INF/versions/9/org/apache/lucene/util/CharsRef.class
- class name in the class file is: org.apache.util.CharsRef

After creating the shadow version relocating org.apache.lucene to shadow.org.apache.lucene7:

- shadow.org.apache.lucene7.CharsRef, the Java 9 version in the shadow jar is located at:
- META-INF/versions/9/org/apache/lucene/util/CharsRef.class {NOT RIGHT]
- META-INF/versions/9/shadow/org/apache/lucene7/util/CharsRef.class [EXPECTED?]
- class name in the class file is correct: shadow.org.apache.lucene7.CharsRef

This was picked up while using ProGuard, which complains about the mismatch between the path hierarchy and the actual class name.

Cheers.
