Maven - Install

Updated: 2020-06-29

Maven keeps a local repository in ~/.m2.

To install is to put the jar inside the local repository.

Install From Source Code

$ mvn install

This will compile the code based on the settings in pom.xml, and copy the jar to ~/.m2

Install A Jar

If the jar is already built, we need to manually specify the groupId, artifactId, version etc

$ mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id> \
    -DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=<packaging>