Skip to content
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

Duplicates Strategy of Jar task is ignored for files of dependencies #475

Closed
AarjavP opened this issue Mar 28, 2019 · 3 comments · Fixed by #1233
Closed

Duplicates Strategy of Jar task is ignored for files of dependencies #475

AarjavP opened this issue Mar 28, 2019 · 3 comments · Fixed by #1233
Labels

Comments

@AarjavP
Copy link

AarjavP commented Mar 28, 2019

Given ProjectA and ProjectB
ProjectB depends on ProjectA
ProjectB has the shadow jar plugin applied
Both projects have com.example.ClassX
duplicatesStrategy is configured for the shadowJar task as shown below.

Shadow Version

5.0.0

Gradle Version

5.3.1

Actual Behavior

running shadowJar task is successful and only the ProjectB's ClassX is in the jar (I think, haven't checked if the zip has multiple entries with same path)

Expected Behavior

Either documentation for duplicatesStrategy behavior, or have same behavior as the specified duplicatesStrategy (Fail in this case)

Gradle Build Script(s)

shadowJar {
    duplicatesStrategy = DuplicatesStrategy.FAIL
}
@AarjavP
Copy link
Author

AarjavP commented Mar 28, 2019

I think this was some issue on my end, after doing clean and clearing gradle cache this is working again (using the DuplicatesStrategy). I was originally doing the clean because the minimize excludes were also not taking effect. Not sure what put it into bad state.

If it happens again I'll create a different issue with what I was doing and try to reproduce it.

@AarjavP AarjavP closed this as completed Mar 28, 2019
@JamesXNelson
Copy link
Contributor

I'm currently facing this issue now, and will try to collect more information while I have it in a bad state. So far, I've tried --rerun-tasks and --no-build-cache each in isolation, and already had shadowJar.inputs.file(buildFile) workaround for another issue in place...

@JamesXNelson
Copy link
Contributor

By my read, com.github.jengelman.gradle.plugins.shadow.tasks.ShadowCopyAction.StreamAction#visitArchiveFile will de-duplicate regardless of the settings for duplicatesStrategy...

My use case is a little different, I WANT the duplicates included, and it looks like I need to ditch shadow plugin to get it (no time to wait for patches, I just need it yesterday ^-^ ).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants