Maven : How to use local lib directory for dependencies instead of maven respoitories

Viewed 9928

My project structure as below during the integration test.

 Project-A
    |_conf (contains the configuration files)
    |_lib  (Contains the all dependencies)
    |_pom.xml
    |_target
        |_test (Contains the integration tests)

When I run the below maven command it download the dependencies from nexus and pointing to the local repositories instead of lib directory.

How Do I tell maven to check lib folder for dependencies instead of local maven repository?

Note : lib contains the all the dependencies which are required to test the project.

    mvn surefire:test
1 Answers

If you want to use dependency that is not in maven repo, then you can place those jars in in project (in your case lib directory). And specify the path of the jar to use like below.

<dependency>
    <groupId>anything</groupId>
    <artifactId>anything</artifactId>
    <version>anything</version>
    <scope>system</scope>
    <systemPath>${basedir}/lib/jar-name.jar</systemPath>
</dependency>

Here you can mention anything for groupId, artifactId and version. These fields are just ignored in this case.

Related