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

Configuring publishing before shadowJar publishes jar with wrong configuration #945

Closed
gharris1727 opened this issue Aug 23, 2024 · 3 comments · Fixed by #904 or #956
Closed

Configuring publishing before shadowJar publishes jar with wrong configuration #945

gharris1727 opened this issue Aug 23, 2024 · 3 comments · Fixed by #904 or #956

Comments

@gharris1727
Copy link
Contributor

gharris1727 commented Aug 23, 2024

Originally reported in Goooler#106

I discovered that my project was configuring publishing before the actual shadowJar, which was causing the wrong classifier to get picked up by the shadow plugin. Is this a reasonable situation that could be improved with lazy evaluation, or should I restructure my build file to configure shadowJar first?

Shadow Version

8.1.4-8.1.8 of Goooler's fork

Gradle Version

8.8

Expected Behavior

The archive published has the classifier that I specified in shadowJar archiveClassifier

Actual Behavior

The archiveClassifier is all

Gradle Build Script(s)

See this modified unit test in my fork, which is failing:
https://github.com/gharris1727/shadow/blob/772444c88e9fbec864364fdc5de6134bb4ccfa2f/src/test/groovy/com/github/jengelman/gradle/plugins/shadow/PublishingSpec.groovy#L81-L127

Content of Shadow JAR (jar tf - post link to GIST if too long)

N/A

@gharris1727
Copy link
Contributor Author

gharris1727 commented Aug 23, 2024

It appears that the test I provided is failing not due to eager evaluation (a flaw in the patch proposed in #904) but because the patch #904 is not present at all in this fork, and the original bug #860 is still unresolved.

This is a warning for anyone that was relying on fixes in Goooler#80 in Goooler's 8.1.4-8.1.8, that the new 8.3.0 release may be missing some of of those changes.

@gharris1727
Copy link
Contributor Author

@Goooler Please reopen this issue, as it is not fixed by #904. I have updated the reproduction case with the latest main and it's still failing: https://github.com/gharris1727/shadow/blob/7af7461081f60bbfc066d53579e780191700af91/src/test/groovy/com/github/jengelman/gradle/plugins/shadow/PublishingSpec.groovy#L81-L127

This issue is about the order-sensitivity of the #904 patch, which did not get fixed since 8.1.4-8.1.8.

@Goooler
Copy link
Member

Goooler commented Sep 3, 2024

Thanks for the headsup!

Cause we can't obtain the correct archiveClassifier in this case, as a workaround, please configure shadowJar before publishing.

def archiveTask = project.tasks.withType(ShadowJar).getByName("shadowJar")
new Archive(archiveTask.archiveFile, archiveTask.archiveClassifier)

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