Skip to content

Avoid duplicate pkl-gradle publication#1777

Open
RushikeshGandhmal wants to merge 1 commit into
apple:mainfrom
RushikeshGandhmal:fix/1742-pkl-gradle-plugin-publication
Open

Avoid duplicate pkl-gradle publication#1777
RushikeshGandhmal wants to merge 1 commit into
apple:mainfrom
RushikeshGandhmal:fix/1742-pkl-gradle-plugin-publication

Conversation

@RushikeshGandhmal

@RushikeshGandhmal RushikeshGandhmal commented Jul 15, 2026

Copy link
Copy Markdown

Summary

  • stop applying pklPublishLibrary to pkl-gradle, since java-gradle-plugin already creates the pluginMaven publication
  • retain the shared POM metadata, validation, signing, and archive-artifact configuration without creating a duplicate publication
  • allow POM validation to target pluginMaven while preserving the existing library default

java-gradle-plugin creates pluginMaven from the Java component. Applying pklPublishLibrary created a second library publication 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

  • reproduced the duplicate on a clean upstream main checkout by confirming identical library and pluginMaven POMs 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=plain
  • confirmed the pluginMaven POM is generated and the duplicate library POM is absent
  • confirmed the dry run schedules only pluginMaven and the required pklPluginMarkerMaven publication
  • confirmed signing tasks remain for both publications
  • compared pluginMaven module metadata with the baseline and confirmed the main, sources, and Javadoc publication artifacts are unchanged
  • confirmed the legacy archives variant still contains the main, sources, and Javadoc JARs
  • ./gradlew :pkl-gradle:spotlessCheck
  • git diff --check

@RushikeshGandhmal

Copy link
Copy Markdown
Author

Hi @bioball,

I manually reproduced the behavior described in #1742.

Before the fix, the generated POMs for the library and pluginMaven publications had identical SHA-256 hashes. A Sonatype dry run also scheduled both publication tasks:

  • publishLibraryPublicationToSonatypeRepository
  • publishPluginMavenPublicationToSonatypeRepository

This reproduced the duplicate publication reported in the issue. No artifacts were uploaded because publication was tested with --dry-run.

Before-fix reproduction showing duplicate publications

I then repeated the verification on the current PR head, 5c9cc958.

After the fix:

  • The pkl-gradle tests and build pass.
  • generatePomFileForPluginMavenPublication runs successfully.
  • The pluginMaven POM is generated and validated.
  • No duplicate library POM is generated.
  • The Sonatype dry run schedules only pluginMaven and the required pklPluginMarkerMaven publication.
image

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
@RushikeshGandhmal
RushikeshGandhmal force-pushed the fix/1742-pkl-gradle-plugin-publication branch from 5c9cc95 to 7b5b137 Compare July 15, 2026 05:10
artifacts {
tasks.findByName("javadocJar")?.let { archives(it) }
tasks.findByName("sourcesJar")?.let { archives(it) }
}

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

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

Successfully merging this pull request may close these issues.

Warning during publish: Multiple publications with coordinates 'org.pkl-lang:pkl-gradle:0.32.0' are published to repository 'sonatype'

1 participant