mvncfg

module
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 16, 2026 License: MIT

README

mvncfg

CI Tests Release Go Version Platforms

A tiny CLI to switch between Maven settings.xml profiles.

Table of contents

Features

  • init — initialize the ~/.m2/profiles directory and a default profile.
  • list — list available Maven profiles.
  • current — show the active profile.
  • use <profile> — switch to another profile.
  • create <profile> — create a new profile from a default settings.xml template.
  • delete <profile> — delete a profile (cannot delete the active one).
  • rename <old> <new> — rename a profile (updates the symlink if active).
  • install-completion — set up shell completion for bash or zsh.
  • version / --version — show the installed version.

Requirements

  • Go 1.26+ (only for go install or building from source).
  • Linux, macOS, or Windows.

On Linux and macOS, the active profile is a symlink at ~/.m2/settings.xml. On Windows, where symlinks require special privileges, settings.xml is instead a plain copy of the active profile and mvncfg records the active profile name in ~/.m2/profiles/.active. Consequence on Windows: editing a profile file directly does not update the active settings.xml — re-run mvncfg use <profile> to apply changes.

Installation

Quick install

Clone the repository and run the install script:

git clone https://github.com/Thomas-PEYROT/mvncfg.git && cd mvncfg && ./install.sh
Using go install
go install github.com/Thomas-PEYROT/mvncfg/cmd/mvncfg@latest

Make sure $HOME/go/bin (or $GOPATH/bin) is in your PATH.

From a GitHub release

Download the binary for your platform from the releases page, make it executable, and place it in a directory in your PATH.

Example for Linux amd64:

curl -sL -o ~/.local/bin/mvncfg https://github.com/Thomas-PEYROT/mvncfg/releases/latest/download/mvncfg-linux-amd64
chmod +x ~/.local/bin/mvncfg

Example for Windows amd64 (PowerShell):

Invoke-WebRequest -Uri https://github.com/Thomas-PEYROT/mvncfg/releases/latest/download/mvncfg-windows-amd64.exe -OutFile "$env:LOCALAPPDATA\Programs\mvncfg\mvncfg.exe"

Make sure the destination directory is in your PATH.

From source
git clone https://github.com/Thomas-PEYROT/mvncfg.git
cd mvncfg
go build -o ~/.local/bin/mvncfg ./cmd/mvncfg

Or use the provided install script from the clone:

git clone https://github.com/Thomas-PEYROT/mvncfg.git
cd mvncfg
./install.sh

By default, ./install.sh installs to ~/.local/bin and configures completion for your current shell. You can force a specific shell:

./install.sh zsh
./install.sh bash

Shell completion

Completion is available for bash and zsh (on Windows, use Git Bash or WSL).

After installing the binary:

mvncfg install-completion

Then reload your shell:

source ~/.bashrc   # or ~/.zshrc

Usage

mvncfg init                  # initialize profiles directory and default profile
mvncfg list                  # list available profiles
mvncfg current               # show the active profile
mvncfg use <profile>         # activate a profile
mvncfg create <profile>      # create a new profile from a default template
mvncfg delete <profile>      # delete a profile (not the active one)
mvncfg rename <old> <new>    # rename a profile
mvncfg install-completion    # install shell completion
mvncfg help [command]        # show help
mvncfg version               # show version
mvncfg --version             # show version

File layout

mvncfg expects Maven profiles to live in ~/.m2/profiles/ and manages the active configuration via ~/.m2/settings.xml (a symlink on Linux/macOS, a plain copy on Windows).

~/.m2/
├── profiles/
│   ├── default.xml
│   ├── work.xml
│   ├── personal.xml
│   └── .active          # Windows only: name of the active profile
└── settings.xml -> profiles/work.xml

Development

go test ./...
go build ./cmd/mvncfg

Platform support

Platform Architecture Status
Linux amd64, arm64 ✅ supported
macOS amd64, arm64 ✅ supported
Windows amd64, arm64 ✅ supported

Directories

Path Synopsis
cmd
mvncfg command
internal
completion
Package completion provides shell completion scripts for mvncfg.
Package completion provides shell completion scripts for mvncfg.
config
Package config resolves the Maven configuration directories used by mvncfg.
Package config resolves the Maven configuration directories used by mvncfg.
profile
Package profile implements the mvncfg profile operations.
Package profile implements the mvncfg profile operations.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL