The official command-line client for mvn.sh. It installs an authenticated mvn.sh repository profile in Maven's settings.xml.
curl -fsSL https://github.com/mvn-sh/cli/raw/refs/heads/main/install.sh | shThe installer verifies the release checksum and places mvnsh in ~/.local/bin. Set MVNSH_INSTALL_DIR to choose another directory.
Download the MSI package from GitHub Releases, or install from PowerShell:
irm https://github.com/mvn-sh/cli/raw/refs/heads/main/install.ps1 | iexBoth Windows installers add mvnsh to your PATH.
go install github.com/mvn-sh/cli/cmd/mvnsh@latestDownload the archive for your platform from GitHub Releases, then place the mvnsh binary on your PATH.
mvnsh loginThe 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. Each repository gets a distinct server and profile ID (for example, mvn-sh-acme-releases and mvn-sh-acme-snapshots), so logging into one repository does not overwrite another repository's credentials. Managed entries are marked with mvnsh: comments and only the matching repository entry is 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 releasesRun mvnsh login -h for all options, including custom Maven settings and profile paths.
Add the repository to the Maven pom.xml, Gradle build.gradle, or Gradle Kotlin DSL build.gradle.kts in the current project:
mvnsh configureThe command interactively opens mvn.sh to select a team and repository when they are omitted. It configures both dependency resolution and distribution/publishing, follows each build tool's syntax, preserves existing repositories, and is safe to run repeatedly. Maven resolves credentials from the server installed by mvnsh login (the repository IDs match by default). Gradle reads its publishing password from MVN_TOKEN, keeping credentials out of source control. For automation, pass --team and --repository. Use --project for another directory, --type to select a build tool explicitly, or --id to override the repository ID.
Update an installed release at any time:
mvnsh updatego test ./...
go build -o bin/mvnsh ./cmd/mvnshTo 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'