Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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
like image 916
sree1611 Avatar asked Mar 05 '23 17:03

sree1611


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.

like image 99
Deepak Kumar Avatar answered Apr 26 '23 18:04

Deepak Kumar