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

Prevent shadow jar from automatically being added as publish artifact #783

Closed
mgroth0 opened this issue Jul 22, 2022 · 5 comments
Closed

Comments

@mgroth0
Copy link

mgroth0 commented Jul 22, 2022

I've noticed that if a Project applies the ShadowJar plugin, that shadow jars are automatically added to the maven publication. I do not want this. I read the docs on maven publishing but it was confusing and didn't seem to explain how to disable shadow jars from automatically being added as artifacts in publications.

@mgroth0 mgroth0 changed the title Prevent Shadow Jar frp, going into maven publication Prevent shadow jar from automatically being added as publish artifact Jul 22, 2022
@mgroth0
Copy link
Author

mgroth0 commented Jul 22, 2022

I have my publication configured like so:

 the<PublishingExtension>().publications.register("mavenJava", MavenPublication::class.java) {
		it.from(components.asMap["java"])
}

@mgroth0
Copy link
Author

mgroth0 commented Jul 24, 2022

I've been able to successfully remove the shadow jars from the maven publications by manually removing them from the artifacts of the publication. But I cannot remove the task dependency. publishMavenJavaPublicationToMavenLocal and generateMetadataFileForMavenJavaPublication continue to depend on the shadowJar task, forcing it to execute even when not needed.

@rjrudin
Copy link

rjrudin commented Apr 26, 2024

@mgroth0 Did you find any solution for this? Ran into the same thing today, would like to prevent the shadow jar from being published but cannot find a mechanism for doing so.

@rjrudin
Copy link

rjrudin commented Apr 26, 2024

Looks like this incantation does the trick - #586 (comment) .

This ticket can likely be closed as a duplicate of #586, which is still requesting that the publication of the shadow jar not be enabled by default.

@mgroth0
Copy link
Author

mgroth0 commented May 5, 2024

@rjrudin Thanks for following up on this.

I no longer apply the shadow plugin in any of my modules that are publishing to a maven repo. This has been my workaround all this time, which is not ideal.

Looking at my old comment, I think the main problem for me ended up being the task dependency. shadowJar is an expensive task and I am publishing to mavenLocal very often so I can't always be running shadowJar.

I will close this in favor of #586. Thanks!

@mgroth0 mgroth0 closed this as completed May 5, 2024
@mgroth0 mgroth0 closed this as not planned Won't fix, can't repro, duplicate, stale May 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants