You are here

Install 3rd party jar into local maven repository

I have one project which has a dependency that can not retrieve from Maven repository. So I use systemPath to import jar from local.

  1. <dependency>
  2. <groupId>QRCode</groupId>
  3. <artifactId>QRCode</artifactId>
  4. <version>1.0</version>
  5. <scope>system</scope>
  6. <systemPath>${project.basedir}/src/main/webapp/WEB-INF/lib/QRCode.jar</systemPath>
  7. </dependency>

But when I use dependency in dependencyManagement, exception comes:

[WARNING] 'dependencyManagement.dependencies.dependency.systemPath' for QRCode:QRCode:jar should not point at files within the project directory, ${project.basedir}/src/main/webapp/WEB-INF/lib/QRCode.jar will be unresolvable by dependent projects @ line 601, column 16

The QRCode.jar should be install inot local maven repository.

mvn install:install-file
-DgroupId=package name
-DartifactId=project name
-Dversion=version
-Dpackaging=jar
-Dfile=jar path

in cmd execute mvn install
Format:

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

  1. mvn install:install-file -Dfile=D:\QRCode.jar -DgroupId=QRCode -DartifactId=QRCode -Dversion=1.0 -Dpackaging=jar

Last change the dependency pom.xml

  1. <dependency>
  2. <groupId>QRCode</groupId>
  3. <artifactId>QRCode</artifactId>
  4. <version>1.0</version>
  5. </dependency>

Blog: