Avoid duplicate pkl-gradle publication#1777
Conversation
|
Hi @bioball, I manually reproduced the behavior described in #1742. Before the fix, the generated POMs for the
This reproduced the duplicate publication reported in the issue. No artifacts were uploaded because publication was tested with
I then repeated the verification on the current PR head, After the fix:
No artifacts were uploaded during these checks. |
The java-gradle-plugin already creates the pluginMaven publication. Applying the library publishing convention creates another publication with the same coordinates, causing an overwrite warning during Sonatype publishing. Configure the shared POM metadata, validation, signing, and archive artifacts directly so pkl-gradle retains the convention behavior without creating the duplicate library publication. Fixes apple#1742
5c9cc95 to
7b5b137
Compare
| artifacts { | ||
| tasks.findByName("javadocJar")?.let { archives(it) } | ||
| tasks.findByName("sourcesJar")?.let { archives(it) } | ||
| } |
There was a problem hiding this comment.
pklPublishLibrary also added the sources and Javadoc JARs to the legacy archives configuration. Since pkl-gradle no longer applies that convention, this block preserves the existing archive behavior without recreating the duplicate library publication.


Summary
pklPublishLibrarytopkl-gradle, sincejava-gradle-pluginalready creates thepluginMavenpublicationpluginMavenwhile preserving the existinglibrarydefaultjava-gradle-plugincreatespluginMavenfrom the Java component. ApplyingpklPublishLibrarycreated a secondlibrarypublication from that same component with the same coordinates, causing the Sonatype overwrite warning.This is a fresh submission of #1761 following the reviewer invitation to resubmit.
Fixes #1742
Verification
maincheckout by confirming identicallibraryandpluginMavenPOMs and both Sonatype publication tasks./gradlew :pkl-gradle:clean :pkl-gradle:validatePom :pkl-gradle:build :pkl-core:validatePom :pkl-bom:validatePom :stdlib:validatePom --no-build-cache --console=plain./gradlew :pkl-gradle:publishToSonatype --dry-run --console=plainpluginMavenPOM is generated and the duplicatelibraryPOM is absentpluginMavenand the requiredpklPluginMarkerMavenpublicationpluginMavenmodule metadata with the baseline and confirmed the main, sources, and Javadoc publication artifacts are unchangedarchivesvariant still contains the main, sources, and Javadoc JARs./gradlew :pkl-gradle:spotlessCheckgit diff --check