mvn.sh CLI
The official command-line client for mvn.sh. It installs an authenticated mvn.sh repository profile in Maven's settings.xml.
Install
Go
go install github.com/mvn-sh/cli@latest
Release archive
Download the archive for your platform from GitHub Releases, then place the mvnsh binary on your PATH.
Usage
mvnsh login
The CLI opens mvn.sh in your browser. Sign in, choose a team and repository, and approve the scoped credential. The CLI then updates ~/.m2/settings.xml with:
- a Maven server containing the token credentials;
- a repository and plugin repository profile;
- an active-profile entry.
Existing Maven configuration is retained. Managed entries are marked with mvnsh: comments and replaced on subsequent logins. The original file is copied to ~/.m2/settings.xml.bak, and the resulting settings file is restricted to the current user.
For automation, provide an existing scoped token:
MVN_TOKEN='mvn_…' mvnsh login --team acme --repository releases
Run mvnsh login -h for all options, including custom Maven settings and profile paths.
Local development
go test ./...
go build -o bin/mvnsh .
To use a local mvn.sh stack:
./bin/mvnsh login \
--app-url 'http://localhost:3000' \
--api-url 'http://localhost:8080' \
--base-url 'http://%s.localhost:8080'
License
Apache License 2.0