Skip to main content

Maven Settings Profile Switcher

Project description

MSPS - Maven Settings Profile Switcher

PyPI - Version PyPI - Python Version PyPI - License Sonar Coverage Sonar Quality Gate

MSPS is a user-friendly tool that simplifies switching between various Maven settings profiles.

The problem

Profiles let you set up repositories or servers for each project or environment, streamlining your workflow and keeping your workspace clean. You can set up different settings for personal coding, testing new tools, and work. However, there are a few settings, like mirror configurations, that can't be tucked away in profiles.

This means if you need to switch between a private mirror in one environment and the Maven Central in another, you'll need to make those adjustments directly in the settings.xml file itself, or you might need to replace the entire file. This can be cumbersome, especially when managing many profiles and switching between them frequently.

:hammer: Requirements

  • Python 3.10 or later

[!NOTE] Developed and tested on Linux (Ubuntu); may also work on macOS.

:floppy_disk: Installation

pip install msps

:gear: Configuration

Maven settings profiles

The tool expects the Maven settings profiles to be stored in the Maven home directory.

MSPS first checks the M2_HOME environment variable to identify the Maven home directory. If this variable is not set, it searches for the .m2 directory within the user's home directory.

The profiles should be named in the following format:

settings__profile_name.xml

:wrench: Usage

msps <command> [profile]

Commands

  • switch - Switch to the next available profile or the specified profile.
  • list - List available profiles.

Profile

  • The name of the profile to switch to.

:man_mechanic: Examples

Unspecified profile switch

The tool will automatically switch to the next available profile.

msps switch
╭──────────── Maven Settings Profile Switcher ────────────╮
│                                                         │
│  Profile changed from current_profile to next_profile.  │
│                                                         │
╰─────────────────────────────────────────────────────────╯

Switch to profile

The specified profile will be activated.

msps switch work
╭───────────── Maven Settings Profile Switcher ──────────────╮
│                                                            │
│  M2_HOME: /home/testuser/.m2/                              │
│  Available settings profiles:                              │
│    - personal (/home/testuser/.m2/settings__personal.xml)  │
│    - work (/home/testuser/.m2/settings__work.xml)          │
│  Profile changed from personal to work.            │
│                                                            │
╰────────────────────────────────────────────────────────────╯

Switch to non-existent profile

No changes will be made if the specified profile is not found.

msps switch target_profile
╭───────────── Maven Settings Profile Switcher ──────────────╮
│                                                            │
│  Missing profile: target_profile                           │
│                                                            │
│  M2_HOME: /home/testuser/.m2/                              │
│  Available settings profiles:                              │
│    - personal (/home/testuser/.m2/settings__personal.xml)  │
│    - work (/home/testuser/.m2/settings__work.xml)          │
│  No changes were made.                                     │
│                                                            │
╰────────────────────────────────────────────────────────────╯

List available profiles

msps list
╭───────────── Maven Settings Profile Switcher ──────────────╮
│                                                            │
│  Available settings profiles:                              │
│    - personal (/home/testuser/.m2/settings__personal.xml)  │
│    - work (/home/testuser/.m2/settings__work.xml)          │
│                                                            │
╰────────────────────────────────────────────────────────────╯

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

msps-1.0.2.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

msps-1.0.2-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file msps-1.0.2.tar.gz.

File metadata

  • Download URL: msps-1.0.2.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for msps-1.0.2.tar.gz
Algorithm Hash digest
SHA256 ad61158feda9482572dabe1c274363aad4147e4144ccf7d9f54b18cf4eebec7e
MD5 f5a0986eb17ac038454a3634498eda77
BLAKE2b-256 bc0d7db3241df9d6f1a0bbd4ede913f2ac573990f75a5252b0f23c2e09b7fb66

See more details on using hashes here.

Provenance

File details

Details for the file msps-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: msps-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 8.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for msps-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 525519ec5e843329e9c02ac1a580936d7353778ad163d0f8fcf8e4ed9b1cd779
MD5 1fa0803deeeaa00262a42e28b8a85b6d
BLAKE2b-256 0b436104d9a3a1a70197353e34f545a061c069294d13504c68bec48b3154742e

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page