-
Notifications
You must be signed in to change notification settings - Fork 408
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add docs for the usages of DuplicatesStrategy
#520
Comments
You can achieve this by using:
Your stuff is added first to the jar and everything with the same path that comes later is simply ignored. |
Slightly related to #710, which is only about |
This behavior is not clear, and that is at least part of the problem. If we set aside, for the moment, our respective preferences in how this plugin should behave, the documentation does not seem to discuss this at all. If we are configuring our project to produce a module-info.class file, we expect that this file would be included in the jars that we produce. This is a specifically intentional configuration. When we want to roll anywhere between one and all of our dependencies in our jar, there is no reason why we would think that our JPMS configuration should be omitted. If the issue is that module-info.class collides with a dependency's module-info.class and is, therefore, entirely left out, there is no warning in the build that brings any attention to this. It is silently dropped on the floor. I have tried your recommended workaround, but even when including the configuration to exclude duplicates, it still drops the module-info.class file in the root of the jar in the plugin version 8.3.5 and 9.0.0-beta7. I am really struggling to understand why this is the deliberately chosen behavior. |
shadow/src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/ShadowJavaPlugin.kt Line 140 in a1295f3
I believe you can try out tasks.shadowJar {
excludes.remove(
"module-info.class"
)
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
} with 9.0.0-beta9, see #1298. |
DuplicatesStrategy
DuplicatesStrategy
DuplicatesStrategy
Hi!
It would be very helpful to be able to exclude files but only if they come from dependencies, not project's. Some examples:
If we exclude them with the current API, project's files will also get excluded from the final JAR, but that's very undesired.
Thank you!
The text was updated successfully, but these errors were encountered: