Skip to content

Publish releases to a git-hosted Maven repository - #5

Merged
Tob1as864 merged 4 commits into
masterfrom
claude/reqif-parser-git-maven-repo-ed8cjq
Sep 9, 2026
Merged

Tob1as864 merged 4 commits into
masterfrom
claude/reqif-parser-git-maven-repo-ed8cjq

Conversation

@Tob1as864

Copy link
Copy Markdown
Owner

Sets up publishing of de.uni_stuttgart.ils:reqif4j into the separate public repository Tob1as864/maven-repo, which holds a plain Maven repository layout and is served over raw.githubusercontent.com. Consumers need neither a GitHub token nor a settings.xml entry.

Maven's layout namespaces artifacts by groupId and artifactId, so that repository can hold further libraries side by side later on.

Changes

  • pom.xmldistributionManagement pointing at a configurable output directory (maven.repo.dir), plus project url, licenses and scm metadata. A release profile attaches the sources and javadoc jars; keeping it out of the default build leaves mvn verify unchanged.
  • .github/scripts/publish-maven-repo.sh — clones the target repository, deploys into it, commits and pushes. Handles a still empty target repository, and only bootstraps a README when the target has none, so a hand-maintained index there is never clobbered. Release versions are immutable: re-publishing an existing one fails instead of overwriting. The pom version is set for the build only and restored afterwards, so no version bump is committed here.
  • .github/workflows/release.yml — runs the script for v* tags (v1.2.0 publishes 1.2.0) and via manual dispatch. Authenticates with an SSH deploy key from the secret MAVEN_REPO_DEPLOY_KEY, which grants write access to the Maven repository only; GITHUB_TOKEN needs read permission only. Malformed or missing secrets are rejected up front with an actionable message rather than an opaque SSH failure after a full build.
  • README.md — consumer instructions for Maven and Gradle, an explanation of the repository <id> and the <snapshots> element, and the one-time deploy key setup.

Verification

Exercised end to end against a local target repository:

  • publishing into an empty target repository, and into one that already has content
  • a second library (different groupId and artifactId) published into the same repository, coexisting with reqif4j
  • a consumer project resolving both libraries from that repository and compiling against them
  • maven-metadata.xml correctly merged across releases and snapshots
  • the immutability guard, the PUSH=false dry run, and restoration of the pom version after a failed run
  • mvn verify unchanged: 154 tests pass, no javadoc overhead in the default build

Snapshot resolution was checked separately: the <snapshots> element is documented as an opt-out, since Maven enables snapshots for a self-declared repository by default.

Before merging

The repository Tob1as864/maven-repo has to exist and be publicraw.githubusercontent.com requires a token for private repositories. The deploy key setup is documented in the README section One-time setup of the publishing credentials.

🤖 Generated with Claude Code

https://claude.ai/code/session_01HUkGAHmCwySzzQG74U5C3H


Generated by Claude Code

Adds a release pipeline that deploys reqif4j into a generated `maven-repo`
branch of this repository. The branch holds a plain Maven repository layout
and is served over raw.githubusercontent.com, so consumers need neither a
GitHub token nor a settings.xml entry.

- pom.xml: distributionManagement pointing at a configurable output directory
  (`maven.repo.dir`), plus project url/licenses/scm metadata. A `release`
  profile attaches the sources and javadoc jars; keeping it out of the default
  build leaves `mvn verify` on CI unchanged.
- .github/scripts/publish-maven-repo.sh: checks out the maven-repo branch as a
  worktree (creating it as an orphan branch on first run), deploys into it and
  commits the result. Existing versions and the merged maven-metadata.xml are
  preserved; release versions are immutable and a re-publish fails instead of
  overwriting. The pom version is only set for the build and restored
  afterwards, so no version bump lands on the source branch.
- .github/workflows/release.yml: runs the script for `v*` tags and via manual
  dispatch.
- ci.yml: skip the generated maven-repo branch, which carries no sources.
- README: consumer instructions for Maven and Gradle, and how to publish.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HUkGAHmCwySzzQG74U5C3H
Both were shown without explanation. The repository <id> is a free-form local
name, unrelated to the artifactId that happens to share it, and <snapshots> is
optional because Maven resolves snapshots from a self-declared repository by
default — verified by resolving a SNAPSHOT with the element omitted and
watching resolution fail only with <enabled>false</enabled>.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HUkGAHmCwySzzQG74U5C3H
The Maven artifacts now go into the standalone public repository
Tob1as864/maven-repo rather than a maven-repo branch of this repository. Maven's
layout namespaces artifacts by groupId and artifactId, so that repository can
hold several libraries side by side, and clones of this repository no longer
carry the published binaries.

- publish-maven-repo.sh: clone the target repository, deploy into it, commit and
  push. Handles a freshly created, still empty target repository, and only
  bootstraps a README when the target has none, so a hand-maintained index
  there is never clobbered. The immutability guard and the pom restore are
  unchanged.
- release.yml: authenticate with an SSH deploy key from the secret
  MAVEN_REPO_DEPLOY_KEY, which grants write access to the Maven repository
  only; GITHUB_TOKEN now needs read permission only. Fails with an actionable
  message when the secret is missing.
- ci.yml: revert the branch filter, there is no generated branch here anymore.
- README: consumer URLs point at the new repository, plus one-time instructions
  for creating the deploy key. Snapshots are documented as an opt-out rather
  than a required element.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HUkGAHmCwySzzQG74U5C3H
A wrong value in MAVEN_REPO_DEPLOY_KEY otherwise surfaces as an opaque SSH
failure at push time, after the whole build has run. The workflow now checks
the secret's first line up front and names the two likely mistakes: a PuTTY
.ppk key, and a single line copied out of a key file rather than the whole
file. The README states the expected format, points PuTTYgen users at
Conversions -> Export OpenSSH key, and notes that a repository secret (not an
environment secret) is what the workflow reads.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HUkGAHmCwySzzQG74U5C3H
@Tob1as864
Tob1as864 merged commit 5e0cdf2 into master Sep 9, 2026
5 checks passed
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.

2 participants