Maven - Install

Last Updated: 2021-11-19

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>