Closed Eladkay closed 7 years ago
Not shading the kotlin libs themselves. Only shading Forgelin and another, completely unrelated library.
Can you post a Gist of your build.gradle file (and gradle.properties/build.properties if you have it)?
Instead of using the old method of shading, try using the Shadow Gradle plugin.
I didn't even know ForgeGradle can take plugins. I'll look into that. How is it related to the problem though? The problem seems to be some sort of double-shading problem.
With the Shadow plugin you can whitelist certain dependencies to shade and exclude transitive dependencies which I don't believe can be done with the old method.
What would I whitelist/blacklist? Forgelin's Kotlin dependency?
Forgelin has Kotlin shaded and it transitively depends on Kotlin so there are technically two copies of Kotlin in your project. Since you're shading the Forgelin jar which has Kotlin builtin and transitively depends on Kotlin, you're getting two copies of Kotlin shaded.
You would have something like this in your build.gradle:
dependencies {
compile "net.shadowfacts:Forgelin:1.1.0"
}
shadowJar {
dependencies {
include(dependency("net.shadowfacts:Forgelin:1.1.0"))
include(dependency("joda-time:joda-time:2.9.6"))
}
}
You would also need to remove the required
configuration and the jars
block from your build.gradle.
Ok, thanks!
Even if this resolves this specific problem, there is another issue related to shading. If a mod using Forgelin 1.1.0+ adds something to the manifest, I am fairly sure there will be a conflict with the manifest file. It might actually be a bad idea all together. I don't know what FML will do when there are several jars with manifests pointing to the same FML core mod.
I firmly believe it should not be recommended to shade Forgelin, mostly because of multiple mods shading the same dependency. This further reinforces it.
Yes, I agree that shading dependencies is seldom a good idea, but in this specific case it is required and it is not likely to cause any problems.
The recommendation has always been not to shade Forgelin, because it defeats its entire purpose as well as potentially causing conflicts.
When building a mod with Forgelin shaded I get this error:
Talking to @JamiesWhiteShirt it seems expected but I still would like to see if there's anything that could be done to make Forgelin shadeable. In this specific case I really cannot use a lib mod.