Recently I was working on one of the common modules developed in our office and as part of the distribution I only got access to the jar built with maven without any dependencies. The jar did include the pom, but it was pointing to a location on intranet which is not accessible to me. After googling I found two ways of handling this situation assuming that the dependencies are available on internet and you got them locally on your harddisk.
Local repository
Declare an entry for a local repo as below:
<repositories>
<repository>
<id>myId</id>
<url>file://path to the folder containing all the libs</url>
</repository>
</repositories>
Once this is defined, follow the same folder structure (groupid/artifactid/version/jar-name) and on the first run, these jars will be imported into the repository. But what if you do not want to pollute your repository with these jars not available on the repo? Here is the second approach. Declare a dependency for each jar as below:
<dependency>
<groupId>gid</groupId>
<artifactId>aid</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>abs path</systemPath>
</dependency>
Couple of alternatives from stackoverflow
Using add jars plugin
Using local repository
No comments:
Post a Comment