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>
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s