Publish to Maven Central from the release workflow - #105
Merged
Merged
Conversation
jmsfx has never published anywhere. A tag cut a GitHub release with jars
attached, so nobody could depend on jmsfx-core or a generated library without
building the repository themselves - which, since the generated libraries are the
things actually consumed, was the gap worth closing.
Following foxglove, which already publishes under the same io.github.ctgnz
namespace, so nothing new needed verifying:
- maven-gpg-plugin signs at verify, with loopback pinentry so CI can sign
unattended. Central requires signed artifacts.
- central-publishing-maven-plugin uploads to the Portal. autoPublish stays false:
a tag stages a validated deployment and publishing is a deliberate click, so a
bad staging can be dropped rather than superseded.
- distributionManagement is deleted rather than corrected. It pointed at
s01.oss.sonatype.org, retired mid-2025, and the Portal plugin uploads directly
rather than deploying to a staging repository.
- setup-java writes the 'central' server and imports the signing key. The plugin
resolves that server before anything else, so without it the build fails on a
null server rather than on a rejected upload - confirmed by running it.
- The publish goes before the release is created, so a failed deploy cannot leave
a release announcing a version that never reached Central. foxglove learned
that the other way round on 0.9.5.
Only the parent, jmsfx-core and jmsfx-standard go to Central - the API a consumer
compiles against and the library it renders with. The other four are excluded by
artifactId; the parent is easy to forget and resolution breaks without it.
The release profile had never actually been run, and it did not work:
- Four poms still pointed the javadoc plugin at nz.co.ctg.jmsfx, the package
namespace from before the rename. jmsfx-server had been corrected and the rest
had not, so javadoc failed with "No source files for package". Their
excludePackageNames named a .model package that no module has.
- IdentificationSymbol carried a {@link GraphicType#FREE_CANVAS} to a type that
file never imports - my own, from #91 - which javadoc rejects as an unresolved
reference. Qualified rather than importing, so nothing unused is added.
- doclint is set to all,-missing. It keeps the checking that found that broken
link and drops "no comment", which reported a hundred undocumented getters and
buried the one real error among them.
Verified as far as it can be without credentials: a full -Prelease build produces
javadoc and sources jars for every module, and the plugin's own debug output
confirms excludeArtifacts parsed to exactly the four intended artifactIds, which
was the part of the XML shape worth checking rather than assuming. The upload
itself is tag-only and first runs for real at 2.0.0 - which autoPublish: false is
what makes safe.
Still needs doing by hand: CENTRAL_USERNAME, CENTRAL_PASSWORD, GPG_PRIVATE_KEY
and GPG_PASSPHRASE as repository secrets, as foxglove has them.
Closes #103
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #103.
jmsfx has never published anywhere — a tag cut a GitHub release with jars attached, so nobody could depend on
jmsfx-coreor a generated library without building the repository themselves. Since the generated libraries are the things actually consumed, that was the gap worth closing, and #102 makes it a hard prerequisite rather than a nicety.Follows foxglove, which already publishes under the same
io.github.ctgnznamespace, so nothing new needed verifying.maven-gpg-pluginverify, loopback pinentry so CI signs unattendedcentral-publishing-maven-pluginautoPublish: falsedistributionManagements01.oss.sonatype.org, and the Portal plugin uploads directlysetup-javacentralserver and imports the signing keyPublishing before the release matters: a failed deploy must not leave a release announcing a version that never reached Central. foxglove learned that the other way round on 0.9.5.
Only the parent,
jmsfx-coreandjmsfx-standardgo to Central. The other four are excluded by artifactId — the applications are delivered as bundles and a deployment, and the generator only becomes publishable when #102 gives library repositories something to depend on. The parent is the easy one to forget, and resolution breaks for every consumer without it.The release profile had never been run, and did not work
This is the part worth reading. Three things were broken and invisible because nothing ever exercised them:
nz.co.ctg.jmsfx— the package namespace from before the rename toio.github.ctgnz.jmsfx-serverhad been corrected; core, standard, creator and editor had not, so javadoc failed outright withNo source files for package. TheirexcludePackageNamesnamed a.modelpackage that no module has.{@link}.IdentificationSymbolreferencedGraphicType#FREE_CANVASwithout importing that type — my own, written in FREE_CANVAS elements still draw a frame in a point-geometry symbol set #91 — which javadoc rejects as an unresolved reference. Qualified rather than imported, so no unused import is added.doclintis nowall,-missing. It keeps the syntax, html and reference checking that caught that link, and dropsmissing, which reported a hundred undocumented getters and buried the one real error among them.Central requires a javadoc jar, so none of this was optional.
How far this is verified
Without credentials the upload itself cannot be exercised, but everything up to it can:
-Preleasebuild now produces javadoc and sources jars for every module, where before it failed on the first.excludeArtifacts = [jmsfx-generator, jmsfx-creator, jmsfx-editor, jmsfx-server]— the XML shape of a list parameter was the part worth checking rather than assuming.centralserver entry fails withCannot invoke Server.clone() because "server" is null, which is whysetup-javagainsserver-id— the plugin resolves that server before it does anything else.mvn verifygreen on the ordinary build.The first real upload is the 2.0.0 tag.
autoPublish: falseis what makes that safe: a bad staging is dropped on the Portal rather than published.Needs doing by hand
Repository secrets, as foxglove has them:
CENTRAL_USERNAME,CENTRAL_PASSWORD,GPG_PRIVATE_KEY,GPG_PASSPHRASE. The workflow will fail at the publish step without them, on a tag only.Rebased onto #104, so the
checkout@v7bumps are already in.🤖 Generated with Claude Code