How to add a local lib directory to Maven

Sometimes there is a dependency not available at a remote repository and one is too lazy to set up a local maven repository – that’s when one adds a directory in the project structure and wants maven to find dependencies there.
  1. Create a directory called “lib” in the project root
  2. Add the following markup to the pom.xml inside the <repositories>-Tag:
<repository>
 <id>lib-repo</id>
 <name>lib-m2-repository</name>
 <url>file://${basedir}/lib</url>
 <layout>legacy</layout>
 <snapshots>
 <enabled>false</enabled>
 </snapshots>
 <releases>
 <checksumPolicy>ignore</checksumPolicy>
 </releases>
</repository>

Tags: , , , , ,

Leave a Reply

Please leave these two fields as-is:

Protected by Invisible Defender. Showed 403 to 10,407 bad guys.