Maven: use non-repository jars

Well you have a local jar that you want to import to your maven project

You can do this one

<dependency>
    <groupId>myjar</groupId>
    <artifactId>myjar</artifactId>
    <version>1.1</version>
    <scope>system</scope>
    <systemPath>${basedir}/lib/myjar.jar</systemPath>
</dependency>

But it is not recomended .

Instead install the jar to your local repository

pathtomaven/mvn install:install-file -Dfile=path/myjar.jar \
 -DgroupId=myjar \
 -DartifactId=myjar \
 -Dversion=1.1 \
 -Dpackaging=jar

and in your pom file

    <dependency>
        <groupId>myjar</groupId>
        <artifactId>myjar</artifactId>
        <version>1.1</version>
    </dependency>
Advertisement