Publish Gradle plugin to Plugin Portal, keep Central listing clean#228
Conversation
Apply com.gradle.plugin-publish so the two java-gradle-plugin marker artifacts (incl. the second groupId) are hosted on the Gradle Plugin Portal via publishPlugins. Disable the marker -> Maven Central tasks so the Central listing carries only the clean featured-gradle-plugin impl jar (+ sources/javadoc/pom). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Review Summary by QodoPublish Gradle plugin to Plugin Portal, keep Central listing clean
WalkthroughsDescription• Publish Gradle plugin to Plugin Portal via com.gradle.plugin-publish • Disable marker artifact publishing to Maven Central for cleaner listing • Add plugin metadata: displayName, description, tags, website, vcsUrl • Marker artifacts now resolve exclusively via Gradle Plugin Portal Diagramflowchart LR
A["java-gradle-plugin<br/>marker artifacts"] -->|"publishPlugins"| B["Gradle Plugin Portal"]
C["featured-gradle-plugin<br/>impl jar"] -->|"enabled=true"| D["Maven Central"]
A -->|"disabled tasks"| E["❌ Maven Central<br/>marker stubs"]
B -->|"clean listing"| D
File Changes1. featured-gradle-plugin/build.gradle.kts
|
Code Review by Qodo
1. Portal publish not automated
|
There was a problem hiding this comment.
Pull request overview
This PR adjusts the Gradle plugin’s publishing setup so the plugin marker artifacts generated by java-gradle-plugin are published to the Gradle Plugin Portal (via publishPlugins), while Maven Central carries only the clean implementation artifact (dev.androidbroadcast.featured:featured-gradle-plugin).
Changes:
- Add the
com.gradle.plugin-publishplugin to the Gradle plugin build and provide required Portal metadata (website/vcsUrl, per-plugin displayName/description/tags). - Disable only the
PublishToMavenCentralRepositorytasks for*PluginMarkerMavenPublicationso marker artifacts no longer end up in the Maven Central staging/bundle. - Add a version-catalog entry for the plugin-publish plugin.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| gradle/libs.versions.toml | Adds version-catalog coordinates for com.gradle.plugin-publish. |
| featured-gradle-plugin/build.gradle.kts | Applies plugin-publish metadata and disables marker → Maven Central publish tasks while leaving the implementation publication enabled. |
| tasks.withType<PublishToMavenRepository>().configureEach { | ||
| if (name.endsWith("PluginMarkerMavenPublicationToMavenCentralRepository")) { | ||
| enabled = false | ||
| } | ||
| } |
There was a problem hiding this comment.
1. Portal publish not automated 🐞 Bug ☼ Reliability
featured-gradle-plugin disables publishing plugin-marker artifacts to Maven Central, but the
release workflow still only runs publishToMavenCentral. This will ship a release where the plugin
ids are not published to the Gradle Plugin Portal (no publishPlugins run), so consumers using the
plugins {} DSL won’t be able to resolve the plugin.
Agent Prompt
### Issue description
The PR disables the marker publications’ Maven Central publish tasks, relying on the Gradle Plugin Portal (`publishPlugins`) for plugin id resolution. However, the current release workflow only runs `publishToMavenCentral`, so a tagged release will no longer publish plugin markers anywhere (Central markers disabled; Portal publish never executed), breaking `plugins { id(...) version "..." }` for consumers.
### Issue Context
- Marker->Central tasks are disabled in `featured-gradle-plugin/build.gradle.kts`.
- `.github/workflows/publish.yml` publishes only to Maven Central.
### Fix Focus Areas
- .github/workflows/publish.yml[43-54]
- build.gradle.kts[17-23]
### What to change
1. Add a `publishPlugins` step to `.github/workflows/publish.yml`, gated on Portal credentials (e.g., `ORG_GRADLE_PROJECT_gradle.publish.key` / `ORG_GRADLE_PROJECT_gradle.publish.secret`, or env vars mapped to them).
2. Optionally add a root-level `publishPlugins` aggregator task (similar to `publishToMavenCentral`) that depends on the included build task `:featured-gradle-plugin:publishPlugins`, so CI can run `./gradlew publishPlugins` consistently.
3. Ensure the Portal step runs on tags (releases) and fails fast if credentials are missing (or is explicitly skipped with a clear log message when not present, depending on desired policy).
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
* Publish Gradle plugin to Plugin Portal, keep Central listing clean (#228) Apply com.gradle.plugin-publish so the two java-gradle-plugin marker artifacts (incl. the second groupId) are hosted on the Gradle Plugin Portal via publishPlugins. Disable the marker -> Maven Central tasks so the Central listing carries only the clean featured-gradle-plugin impl jar (+ sources/javadoc/pom). Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * Publish plugin to Gradle Plugin Portal on tagged releases Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Problem
On Maven Central the Gradle plugin showed up as multiple components, not a single clean library release:
dev.androidbroadcast.featured:featured-gradle-plugin— the real impl jar (good)dev.androidbroadcast.featured:dev.androidbroadcast.featured.gradle.plugin— plugin markerdev.androidbroadcast.featured.application:dev.androidbroadcast.featured.application.gradle.plugin— second marker, under its own groupIdThe marker artifacts are auto-generated by
java-gradle-plugin(one per plugin id). Their coordinates are fixed by Gradle (<id>:<id>.gradle.plugin) and cannot be renamed. On Maven Central they polluted the listing and split the release across two groupId namespaces.Solution
Publish the plugin (and its markers) to the Gradle Plugin Portal — the conventional resolution channel for
plugins { id(...) version "..." }— and keep Maven Central carrying only the cleanfeatured-gradle-pluginimpl jar (+ sources/javadoc/pom).com.gradle.plugin-publish2.1.1; addwebsite/vcsUrl+ per-plugindisplayName/description/tags.*.gradle.pluginstubs no longer reach Central; the Portal hosts them viapublishPlugins.Why not the "canonical" Vanniktech platform switch
Vanniktech's
GradlePublishPluginplatform is auto-selected whencom.gradle.plugin-publishis applied, but in 0.36.0 itsconfigure()is a no-op — it does not scope what goes to Central. Gradle'smaven-publishstill generates apublish<Pub>PublicationToMavenCentralRepositorytask for every publication, markers included. The Central bundle is built by walking the staging dir (MavenCentralBuildService), so a Central task withenabled = falsenever writes its files and the marker is absent from the bundle. Disabling those two tasks is therefore the correct, version-robust mechanism on 0.36 — not a workaround around a working platform.Verification
:featured-gradle-plugin:test— 266/266 passpublishToMavenLocal— BUILD SUCCESSFUL; impl carries jar + sources + javadoc + pom + module…PluginMarkerMavenPublicationToMavenCentralRepositorytasks are disabled;publishPluginMavenPublicationToMavenCentralRepository(impl) stays enabledpublishPlugins(Portal) task presentspotlessCheck— passNo network publish was performed.
Removing markers from Central means
plugins { id(...) }now resolves only via the Gradle Plugin Portal. Before the next release the maintainer must::featured-gradle-plugin:publishPluginsstep to the release workflow, gated on Portal credentialsgradle.publish.key/gradle.publish.secret(GRADLE_PUBLISH_KEY/GRADLE_PUBLISH_SECRET).Side benefit: the README
plugins {}snippet now works out of the box via the defaultgradlePluginPortal(), whereas before it silently requiredmavenCentral()inpluginManagement.🤖 Generated with Claude Code