Adding New Library To Maven Repository

Sometimes, you find a custom library on the internet, or create it by yourself for something special. Probably, you cannot find those kind of libraries in maven repositories and add your maven dependencies for your maven based projects. But, if you need special library in your maven dependencies to package your project, there is a maven feature that enables you to install this library to your local maven repository.

For example I will show you how to add Oracle jdbc driver to your repository. I have Oracle XE in my computer and if you go to this path “C:\oraclexe\app\oracle\product\11.2.0\server\jdbc\lib” you will find Oracle drivers for your use. Or you can just download it from on the internet. Now let’s open a console and write this command:

mvn install:install-file -Dfile="C:\oraclexe\app\oracle\product\11.2.0\server\jdbc\lib\ojdbc6.jar" -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2.0 -Dpackaging=jar

After that you will see a screen like below:
Maven Install Repository

Then you can add this library to your pom.xml like below. Be careful that groupId, artifactId and version are identical with the command above.

<dependency>
    <groupId>com.oracle</groupId>
    <artifactId>ojdbc6</artifactId>
    <version>11.2.0</version>
</dependency>

Developers Rock!!!

Advertisements
This entry was posted in Java and tagged , , , , , . Bookmark the permalink.

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