Monday, 13 August 2012

How to Include a Jar in a Maven Project?

This post is related to an answer I provided on It also contains a solution by Ryan Stewart.

There are situations when a .jar is required by a maven project, but it is not available in any repository. One needs a solution to make it a dependency in one's project. There are two solutions: including the .jar manually in your local repository and declare a systemPath.

Manual Inclusion in Local Repository

This requires a separate maven project based on the following pom.xml:
<project xmlns="" xmlns:xsi=""

    <name>Maven Missing Jars</name>
The configuration section is where one can indicate the location of the .jar to include and the maven coordinates to use, together with the packaging. This is a one time operation.

Use a System Path

Another solution is to to declare the following dependency in your projects' pom.xml:
The first solution can be used to include the .jar in a private or public repository and let all developers use it. The second solution is less hassle if you are working alone on your project.

No comments:

Post a comment