how to add jar to local maven repository code example

Example 1: put jar file in maven

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

Example 2: using local jar in maven

Create a new folder, let's say local-maven-repo at the root of your Maven project.

Just add a local repo inside your <project> of your pom.xml:


<repositories>
    <repository>
        <id>local-maven-repo</id>
        <url>file:///${project.basedir}/local-maven-repo</url>
    </repository>
</repositories>

Tags:

Misc Example