Maven - Installing 3rd party Jars to Local Repository

[Last Updated: Mar 14, 2017]

Sometimes we have to include dependency of a 3rd party Jar which is not maven based project or which doesn't exist in any public repository like Maven Central. We can include those jars in IDE specific project dependency, but maven build can't see those IDE dependencies. We have only one option to install such Jars into maven local repository (.m2 folder).

We can use maven install:install-file plugin using this syntax

mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id>
-DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=<packaging>

For example run this command from any location to install Jortho to local repository

mvn install:install-file

-Dfile should have a valid file path containing your jar. You can put anything non-existent for groupId, artifactId and version.

See Also