user972590
user972590

Reputation: 251

How to specify path for local jars in maven

I am using maven2 to build the java project. when I am trying to build using mvn install I am getting the compilation error saying some package xya.abc.aaa doesnot exist. This package is available in my own jar at local disk. This jar(say test.jar) is created by me.

How can I tell to maven to use this local jar for the package its looking for is availabe at my local disk?

Upvotes: 4

Views: 507

Answers (1)

user177800
user177800

Reputation:

You need to install the dependencies to your local repository.

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

Where: <path-to-file>  the path to the file to load
       <group-id>      the group that the file should be registered under
       <artifact-id>   the artifact name for the file
       <version>       the version of the file
       <packaging>     the packaging of the file e.g. jar

Upvotes: 6

Related Questions