srshma
srshma

Reputation: 25

Download local repository jar dependency files through maven

I was not able to download one jar through maven so i have created one local repository and downloaded jar manually and then added to pom by using system scope

<scope>system</scope>
<systemPath>c:\\bdh\gdhs</systemPath>

but i requires the dependencies of the local repository jar. what should i do then? manually adding each and every dependency jars is not a good solution it seems someone help please..

Upvotes: 1

Views: 1066

Answers (1)

pirho
pirho

Reputation: 12245

Do not use system scope.

Install the downloaded file to local repository.

If you have both pom & artifact

mvn install:install-file -Dfile=<path-to-file> -DpomFile=<path-to-pomfile>

To have its dependencies also resolved correctly - so not to add every dependency by hand - you need the pom.

If you do not have the pom

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

Without pom the dependencies of installed artifact can not be resolved automatically and you need to manually install them (preferably with pom).

Then just add it as dependency:

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

Refer Guide to installing 3rd party JARs for more details

Upvotes: 3

Related Questions