Sami Sami - 1 year ago 120
Java Question

how to add a local jar as a dependency to a maven project?

I am new to Maven and I want to add SSJ library to dependencies in a maven project, I tried adding this in the POM.xml:


but eclipse is giving this error:
Missing artifact ca.umontreal.iro:ssj-2.5

It seems that it's not found in the repository.. I have the jar file, how can I add it to dependencies? if possible. If not, what would be the alternative to include this jar in the project?

Answer Source

You'll need to add the jar to your maven local repository.

mvn install:install-file -Dfile=/path/to/ssj.jar -DgroupId=ca.umontreal.iro -DartifactId=ssj -Dversion=2.5 -Dpackaging=jar

(Change /path/to/ssj.jar to the path of the the file in your computer)

This will make it possible for Maven to resolve this JAR from the local repository using the dependency defined above, when you are building your application.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download