Giter Site home page Giter Site logo

mem's Introduction

mem - Maven Environment Manager

Problem

You build software for multiple companies, or perhaps just one company, but you also have some side projects. You do all this on the same machine. Each company has their own Maven artifact server, each with its own settings.xml file and potentially other settings and company-specific build artifacts, all wanting to be stored in the same ~/.m2 directory. You know you can use Docker or Vagrant to keep things isolated, but feel they are extreme solutions to this problem. You really just need a simple way to switch between Maven environments.

Solution

mem (Maven Environment Manager) is a simple command-line tool to create and switch between Maven environments. It works by converting your ~/.m2 directory into a symbolic link which points to your current environment, located at ~/.m2.<environment>, e.g. .m2.foobar for the foobar environment.

System requirements

mem is known to work in the following environments:

  • Linux distributions with bash
  • macOS / OS X
  • Windows Subsystem for Linux

mem doesn't work with Git Bash as it cannot create symbolic links.

Usage

Initialize

To start managing your Maven environments with mem:

mem init

This will rename your ~/.m2 directory to ~/.m2.default and create a symbolic link pointing ~/.m2 to ~/.m2.default. This effectively creates the first environment, called default, and switches to that environment.

Create an environment

To create an environment and switch to it:

mem create <environment>

For example, to create a new environment called work:

mem create work

Switch to an environment

To switch to an environment:

mem use <environment>

For example, to switch to an environment called side-projects:

mem use side-projects

List environments

To list all your Maven environments:

mem

Example output:

Maven environments:

 * default
 * side-projects [active]
 * work

Delete an environment

To delete an environment:

mem delete <environment>

For example, to delete the environment called side-projects:

mem delete side-projects

Note:

mem will not allow you to delete the currently active environment, because there must always be exactly one active environment and mem isn't smart enough to choose the environment which should become active after the active environment is deleted.

To delete the currently active environment, you must first switch to another environment.

Technical details

mem is a bash script with no dependencies on things like sed and awk, which may not be found in all bash environments.

mem's People

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.