-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
Multiple publications with coordinates warning when running publishToMavenLocal for a gradle plugin artifact #10384
Comments
@embee1981 thanks for bringing this up. What you are doing seems to work ok, but there is still the potential that it may cause issues if you do more modifications to the publication. That's why we introduced the warning. However, the example shows that the warning should carry more context. In particular to help you to get rid of it. Because in this case one of the publications is contributed by the java-gradle-plugin, it is less obvious where the duplication is. You can change the
By referring Now, there is no need to redeclare |
@jjohannes thanks for that, that tweak did the job, no more warning output :-) |
@embee1981 I couldn't find any wrong documentation specifically for plugin publishing. If you should know about anything, please let me know. But I can see that the sources jar publishing is a common use case for adjusting the publication directly. And if you just copy and paste that from the current documentation about publishing Java, you can easily run into this. Gradle 6 will support publishing of sources (and Javadoc) out-of-the-box. The sample code in the updated documentation can now be "copy-pasted" independent of the publication name: https://docs.gradle.org/release-nightly/userguide/building_java_projects.html#sec:java_packaging |
@jjohannes I'm using Kotlin DSL, and get the same warning. It's not clear to me how to extend the
|
Hi @asarkar. You need to use the name publication name For Kotlin DSL it should be:
|
The built-in
This disables adding the publication in Tried and tested in Gradle 5.6.4 |
Sorry to resurrect a closed thread, but in my case, I want to publish a regular artifact and a uber jar, and get the same warning. This situation is not documented in the Gradle public docs (not a multimodule project). My questions:
|
|
If you don't want the shadow version to have different coordinates, the best solution is probably not to have a second publication, but add the shadow Jar as a addditional variant to the
The shadow Jar will then be available with a classifier in the name and will be listed in the Gradle Metadata ( In you current setup the metadata is "broken", because it is generated two times and one overrides the other. That's why you get the warning. See: |
Thank you for your responses. The library in question is currently only packaged as a shadow jar. My intent is to publish the “thin” jar to Maven Central as usual with source and Javadoc, but also make the shadow jar available for existing users. It sounds like adding a variant is the best way to approach that. I’ll try it out and report back. |
Due to the unreliability of jcenter, use the latest version of the com.gradle.plugin-publish plugin. After upgrading, there were warning messages that artifacts were being published to Maven Local multiple times, so removed the redundant source / docs jar artifacts. References: - gradle/gradle#10384
Expected Behavior
No warning should be displayed when publishing a gradle plugin.
Current Behavior
Using gradle 5.6.1 the following is output:
Context
In version 5.5.1, no warning was displayed.
5.6. an error occurs
5.6.1 shows a warning now instead of an error which implies something "bad" will happen which doesn't seem to be the case.
Steps to Reproduce
Use the following build.gradle file
Run
gradle clean publishToMavenLocal
Your Environment
Gradle 5.6.1
The text was updated successfully, but these errors were encountered: