How to add Maven dependency jar file from the lib folder

Another option is to set up a repository that is backed by a directory inside your project, per this answer: https://stackoverflow.com/a/2230464/433789


Have a look at system dependencies.

You basically need to define <scope>system</scope>.

<project>
    ...
    <dependencies>
      <dependency>
        <groupId>javax.sql</groupId>
        <artifactId>jdbc-stdext</artifactId>
        <version>2.0</version>
        <scope>system</scope>
        <systemPath>${java.home}/lib/rt.jar</systemPath>
      </dependency>
    </dependencies>
    ...
</project>

This is if you don't have your own hosted artifact repository server such as Nexus, Artifactory or Archiva.

If you do, then as Karl-Heinz suggested, you would be better off placing it there, as it's not good practice to commit binary artifacts to version control.