Prepare release 2.0.0-alpha.1#129
Conversation
| nmcpAggregation { | ||
| centralPortal { | ||
| username = System.getenv("MAVEN_USERNAME") | ||
| password = System.getenv("MAVEN_PASSWORD") | ||
| publishingType = "AUTOMATIC" | ||
| } | ||
| } |
There was a problem hiding this comment.
🟡 The nmcpAggregation block only configures centralPortal but not centralSnapshots, so the publishAggregationToCentralSnapshots Gradle task called by the CI workflow for SNAPSHOT versions will fail with missing configuration. Either add a centralSnapshots { ... } block to nmcpAggregation or remove the SNAPSHOT branch from the workflow.
Extended reasoning...
What the bug is
The CI workflow (cross.yml, lines 384-392) contains a conditional branch that detects SNAPSHOT versions and calls ./gradlew publishAggregationToCentralSnapshots. However, the nmcpAggregation block in build.gradle (lines 248-254) only configures centralPortal — there is no centralSnapshots configuration block.
How it manifests
The NMCP plugin (com.gradleup.nmcp.aggregation) registers Gradle tasks based on which configuration blocks are present inside nmcpAggregation { ... }. Without a centralSnapshots { ... } block, the publishAggregationToCentralSnapshots task will either not be registered at all (causing a "Task not found" error) or will fail at runtime due to missing repository URL and credentials configuration.
Step-by-step proof
- A developer sets the version in
build.gradleto something like2.0.0-SNAPSHOT. - The CI publish job runs and extracts the version:
VERSION=2.0.0-SNAPSHOT. - The shell conditional
[[ "$VERSION" == *-SNAPSHOT ]]evaluates to true. - The workflow executes
./gradlew publishAggregationToCentralSnapshots. - Gradle looks for the
centralSnapshotsconfiguration innmcpAggregationbut finds onlycentralPortal. - The build fails — either with "Task publishAggregationToCentralSnapshots not found" or with a missing credentials/repository error.
Why existing code does not prevent it
The old publishing configuration explicitly handled both release and snapshot URLs via the removed OSSRH maven repository block, which used version.endsWith('SNAPSHOT') to select between snapshotsRepoUrl and releasesRepoUrl. This PR replaced that with the NMCP plugin but only configured the release portal, not the snapshot repository.
Impact and fix
This is a latent bug — the current version 2.0.0-alpha.1 does not end with -SNAPSHOT, so the broken code path will not trigger for this release. However, the workflow explicitly supports SNAPSHOT publishing (this conditional was added in this PR), and that path is non-functional. The fix is to add a centralSnapshots block inside nmcpAggregation with the appropriate credentials, or remove the SNAPSHOT conditional from the workflow if SNAPSHOT publishing is not needed.
No description provided.