in Coding, Java, Maven

Installing third-party JAR libs in local maven repository


Installing 3rd party JAR libs in local maven repository:

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

Usage:

<dependency>
  <groupId>group-id</groupId>
  <artifactId>artifact-id</artifactId>
  <version>version</version>
</dependency>

Installing 3rd party JAR libs in local maven repository in a different directory:

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

Usage:

<repositories>
  <repository>
    <id>LocalRepo</id>
    <name>Local library folder</name>
    <url>file://full-path</url>
    <layout>default</layout>
    <snapshots>
      <updatePolicy>always</updatePolicy>
    </snapshots>
  </repository>
</repositories>
<dependency>
  <groupId>group-id</groupId>
  <artifactId>artifact-id</artifactId>
  <version>version</version>
</dependency>