Skip to content

mvnd: add 1.0.6 (Maven Daemon, embeds Maven 3.9.16) - #904

Merged
bryan-minimal merged 3 commits into
mainfrom
add-mvnd
Oct 22, 2026
Merged

bryan-minimal merged 3 commits into
mainfrom
add-mvnd

Conversation

@bryan-minimal

@bryan-minimal bryan-minimal commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

Merge after #902. The wrapper forwards #902's MAVEN_REPO_LOCAL; without #902 the variable is never set and mvnd keeps ~/.m2/repository.

What

Adds packages/mvnd, the Apache Maven Daemon 1.0.6 (latest release on apache/maven-mvnd, 2026-05-30; the 2.0.0-rc-* tags are pre-releases on the Maven 4 line). It is a Tier 2 item in the Java loadout checklist (#899).

mvnd has two parts. The client, bin/mvnd, is a GraalVM native image. It hands each build to a long-lived daemon JVM that runs an embedded Maven.

  • Source: the per-arch upstream tarballs maven-mvnd-1.0.6-linux-{amd64,aarch64}.tar.gz, selected with match … target the same way packages/jdk does. Each sha256 was computed locally, and its sha512 matches the Apache dist .sha512 files (downloads.apache.org/maven/mvnd/1.0.6/). The GitHub release publishes no checksums of its own.

  • Layout: the whole distribution goes under /usr/share/mvnd, minus the .cmd launchers and jansi's Windows DLLs. A /usr/bin/mvnd wrapper sets JAVA_HOME=${JAVA_HOME:-/usr/lib/jvm}, because the daemon is spawned from $JAVA_HOME, and pins MVND_HOME.

  • Runtime deps:

    • jdk, for the daemon.
    • glibc, for the native client. Its DT_NEEDED entries on both arches are libc.so.6, libdl.so.2, libpthread.so.0 and librt.so.1, plus ld-linux-aarch64.so.1 on arm64.
    • bash, for the wrapper, bin/mvnd.sh and the embedded Maven's scripts.

    missing runtime_deps passes as is. The glibc ≥2.34 stub libraries (libdl, libpthread, librt) did not need the patchelf --replace-needed treatment that maven's libjlinenative got for libutil (e72c987).

  • Licence: Apache-2.0. Provenance: GithubRepo apache/maven-mvnd.

  • Prebuilt: we have no GraalVM / native-image package, and the daemon side builds with Maven from Maven Central. binary_from records it.

The embedded Maven (please read)

mvnd 1.0.6 bundles Maven 3.9.16 (mvn/lib/maven-core-3.9.16.jar). Our maven package is 3.10.0 (#896). So:

  • No file conflict. The embedded Maven lives at /usr/share/mvnd/mvn. Its bin/mvn is deliberately not put on PATH, so /usr/bin/mvn still belongs to maven. A session with both packages gets mvn = 3.10.0 and mvnd = 3.9.16.
  • Version skew. mvnd and mvn can resolve or behave differently on the same project. The embedded Maven also does not have the libjlinenative libutil problem, because 3.9.x ships no lib/jline-native.
  • Pinned and fail-closed. maven_version = "3.9.16" is in build.ncl. build.sh fails if the tarball's maven-core-<v>.jar disagrees, and the tests assert it. When a future version-bump PR moves mvnd, the embedded Maven change has to be acknowledged explicitly. I checked this guard: setting maven_version to 3.9.15 fails the build.
  • 2.x will change this. The upstream 2.0.0-rc line embeds Maven 4. The version checker will propose it when it goes GA. That is a deliberate bump, not a routine one.

Network

Almost any real mvnd build resolves plugins from Maven Central, so mvnd declares needs = { dns, internet } for consumers, as jbang (#903) does and maven does with #902. That is the one convention for the JVM build tools; gradle should follow in its own PR.

Session state

  • Daemon storage: env_state_wiring sets MVND_DAEMON_STORAGE to /state/mvnd. The native client reads that variable itself, so the registry and logs no longer need a writable $HOME (default ~/.m2/mvnd).
  • Local repository: the wrapper forwards maven's wired MAVEN_REPO_LOCAL (maven: wire the local repository to a session state dir (MAVEN_REPO_LOCAL) #902) as -Dmaven.repo.local, so in a session with both packages mvn and mvnd share one repository. A caller's own -Dmaven.repo.local comes later and still wins.

Tests

Both are Standalone. Each keeps the daemon storage and the local repository in its own cwd by setting MVND_DAEMON_STORAGE and MAVEN_REPO_LOCAL, the two variables a session wires, and runs mvnd --stop afterwards so no JVM outlives the test.

  • mvnd_version: mvnd --version goes through a live daemon. It asserts (mvnd) 1.0.6 from the client and Apache Maven 3.9.16 from the daemon.
  • offline_validate: a real build through the daemon, offline (-o). It runs validate on a packaging=pom project, which binds no plugins, and asserts BUILD SUCCESS, that the daemon registry landed in $MVND_DAEMON_STORAGE, and that -X output names the forwarded repository. Anything beyond that (compile, test) needs Maven Central, so it cannot run in an offline test.

Verified

I built it in a pkgbuild session (arm64) with min package build --rebuild --verbose mvnd, then ran min check --packages mvnd. All checks pass, including standalone tests, missing runtime_deps and enumerate bins.

Negative controls, each in a fresh session:

  • Expecting BUILD XSUCCESS makes standalone tests...Fail.
  • maven_version = "3.9.15" makes the build fail closed.

Re-verified after the review fixes (13f8b06, fresh session): every check passes. Negative control: expecting a different repository path makes offline_validate fail.

amd64 is not locally verified. It is a different tarball and sha256, and CI's build covers it.

Refs #899.

🤖 Generated with Claude Code

Per-arch upstream tarballs (GraalVM native client + daemon jars +
embedded Maven) under /usr/share/mvnd, matched on target arch like
packages/jdk. A /usr/bin/mvnd wrapper defaults JAVA_HOME to the
packaged jdk (the daemon is a JVM) and pins MVND_HOME. The embedded
Maven's bin/mvn stays off PATH; /usr/bin/mvn belongs to `maven`.

The embedded Maven version is pinned in build.ncl; build.sh fails
closed if the tarball's maven-core jar disagrees, and the tests assert
both versions. Standalone tests: --version through a live daemon, and
an offline (-o) `validate` of a packaging=pom project, each stopping
the daemon afterwards.

Refs #899.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bryan-minimal
bryan-minimal requested a review from a team as a code owner October 16, 2026 20:31
@coderabbitai

coderabbitai Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

  • Run on-demand review

This review includes 2 billable files and costs up to $0.50.

  • Ask an admin to make reviews automatic

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Or wait 13 minutes for your next included review.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available. Your 58 included PR review attempts over the past 7 days set your current allowance at 2 reviews per hour.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository: gominimal/pkgs/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: 3c1a2078-601a-4b81-a324-263bed686ed0
📥 Commits

Reviewing files that changed from the base of the PR and between 0618acc and 13f8b06.

📒 Files selected for processing: 2
  • packages/mvnd/build.ncl
  • packages/mvnd/build.sh
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@norrietaylor norrietaylor left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The prebuilt is justified (no GraalVM native-image package) and called out with binary_from. The client's DT_NEEDED is only libc/libdl/libpthread/librt, so glibc is right. Stripping the Windows jansi DLLs is good, and the fail-closed embedded-Maven check is nice.

  1. It doesn't pick up #902's MAVEN_REPO_LOCAL. mvnd's Environment enum has no environment binding for it, so in a session with both packages, mvn uses the state dir and mvnd uses ~/.m2/repository, downloading everything twice. Please pass -Dmaven.repo.local="$MAVEN_REPO_LOCAL" in the wrapper (build.sh:32-34) when it is set.
  2. MVND_DAEMON_STORAGE is a real mvnd environment variable. An env_state_wiring for it would fix the unwritable-$HOME problem the tests currently work around with -Dmvnd.daemonStorage.
  3. needs is inconsistent: jbang (#903) declares network needs; mvnd and maven don't. Let's pick one convention for the JVM build tools.
  4. Rebase needed: the branch predates #897 (jdk → Temurin 25), so CI tested on 21.

On prebuilt vs building from source for the JVM batch, that's a policy call being settled separately.


Generated by Claude Code

bryan-minimal and others added 2 commits October 21, 2026 19:04
…needs

Review fixes:
- The wrapper forwards MAVEN_REPO_LOCAL (maven's wired local repository)
  as -Dmaven.repo.local, so mvn and mvnd in one session share it.
- env_state_wiring MVND_DAEMON_STORAGE -> /state/mvnd: the native client
  reads it itself, so the daemon registry no longer needs a writable HOME.
- needs { dns, internet } as the consumer-facing network dep, matching
  jbang/curl/go/uv: resolving from Maven Central is mvnd's job.
- Tests set the two wired variables instead of -D flags, and check that the
  daemon used that storage and the build that repository.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bryan-minimal

Copy link
Copy Markdown
Member Author

Thanks @norrietaylor. All four are addressed in 13f8b06, on top of a merge of main (c3a0a14):

  1. MAVEN_REPO_LOCAL: the wrapper passes -Dmaven.repo.local="$MAVEN_REPO_LOCAL" when the variable is set, the same way /usr/bin/mvn does in maven: wire the local repository to a session state dir (MAVEN_REPO_LOCAL) #902, so mvn and mvnd share one repository. A caller's own -Dmaven.repo.local comes later and still wins. Merge this after maven: wire the local repository to a session state dir (MAVEN_REPO_LOCAL) #902; the body says so.
  2. MVND_DAEMON_STORAGE: wired with env_state_wiring = { env_var = "MVND_DAEMON_STORAGE", prefix = "mvnd" }, the same shape as gradle's. The tests no longer pass -Dmvnd.daemonStorage. They set MVND_DAEMON_STORAGE and MAVEN_REPO_LOCAL, the two variables a session wires, so they exercise the client's own env binding and the wrapper's forwarding. offline_validate now also asserts that the daemon registry landed in that storage and that the -X output names the forwarded repository. I kept the per-test cwd directories because I don't want a test to depend on whether the harness applies session wiring.
  3. needs: I'm proposing one convention for the JVM build tools: a tool whose job is resolving from Maven Central declares needs = { dns, internet } as the consumer-facing network dep, as jbang does and as curl, go, pnpm and uv do. The tool's own build stays offline. mvnd now declares it, and maven does in maven: wire the local repository to a session state dir (MAVEN_REPO_LOCAL) #902. No package builds with maven, mvnd or gradle today, so this changes nobody's sandbox. gradle should follow in its own PR.
  4. jdk: current LTS (meta over jdk-25); add jdk-25 (Temurin 25) and jdk-21 (Temurin 21) #897: merged main, so CI builds and tests on Temurin 25.

Verified in a fresh pkgbuild session: min package build --rebuild mvnd and min check --packages mvnd pass every check, including standalone tests. Negative control in another fresh session: expecting a different repository path makes offline_validate fail.

🤖 Generated with Claude Code

@norrietaylor norrietaylor left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

All points from my last review are addressed:

  • The wrapper forwards MAVEN_REPO_LOCAL as -Dmaven.repo.local (build.sh:41-43). Upstream marks it DISCRIMINATING, and the last -D wins, so a caller's override still works.
  • MVND_DAEMON_STORAGE is wired, and the test checks it.
  • needs matches maven and jbang.
  • The branch is past #897.

mvn and mvnd now share one local repo when both are in the session. The amd64 sha256 matches, and so does the Apache sha512.

Before merging, please confirm in the full minimal-check log that mvnd's standalone tests actually ran; the visible tail doesn't show a package: mvnd section. Merge after #902.

Non-blocking:

  • Without maven in the session, nothing sets MAVEN_REPO_LOCAL, so mvnd falls back to ~/.m2. That's worth a line in the wrapper comment.
  • Optional: point url at archive.apache.org/dist/maven/mvnd/, the canonical location maven already uses.

Generated by Claude Code

@bryan-minimal

Copy link
Copy Markdown
Member Author

@norrietaylor on the pre-merge check: you were right to ask. CI did not run mvnd's standalone tests. In the full minimal-check log for the head (13f8b06, run 39709743441, job 119597974259), the package: mvnd section shows:

enumerate bins...Skip
output types valid...Skip
missing runtime_deps...Skip
standalone tests...Skip

Every other check passed. CI skips the build-dependent checks for a package it hasn't built and cached, so the green check says nothing about the tests.

They did run in a remote session on the same commit (13f8b06, fresh pkgbuild session, arm64): min package build --rebuild mvnd, then min check --packages mvnd:

enumerate bins...Pass
output types valid...Pass
missing runtime_deps...Pass
standalone tests...Pass

That covers both mvnd_version (through a live daemon) and offline_validate. Negative control, in a separate fresh session: making offline_validate expect a different repository path makes it fail, so its new storage and repository assertions really execute.

🤖 Generated with Claude Code

@bryan-minimal
bryan-minimal added this pull request to the merge queue Oct 22, 2026
Merged via the queue into main with commit 50cea78 Oct 22, 2026
11 checks passed
@bryan-minimal
bryan-minimal deleted the add-mvnd branch October 22, 2026 22:51
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