For adding local jar as your dependencies, there are two way to achieve this.
1) Use scope system
<dependency>
<groupId>poi</groupId>
<artifactId>poi</artifactId>
<version>1.0</version> <!-- Dummy Version -->
<scope>system</scope>
<systemPath>/pathToJar/poi.jar</systemPath>
</dependency>
But using this way some maven building tools failed due to scope system
, like maven-assembly-plugin
and maven-shade-plugin
. To avoid this use following way.
2) By creating local repository,
Create directory repo
in your project directory. Run following maven command to install jar to local repository,
mvn deploy:deploy-file -Durl=file:///path/toyourproject/repo/ -Dfile=/pathToJar/poi.jar -DgroupId=poi -DartifactId=poi -Dpackaging=jar -Dversion=1.0
Run mvn deploy
command in project folder via cmd. If mvn
is not installed in your machine then use following links for same.
And add local repository entry pom.xml.
<repositories>
<repository>
<id>project.local</id>
<name>project</name>
<url>file:${project.basedir}/repo</url>
</repository>
</repositories>
Finally add your dependency,
<dependency>
<groupId>poi</groupId>
<artifactId>poi</artifactId>
<version>1.0</version>
</dependency>
This dependency will use jar from your local repo created in project folder.