How to add local jar files to a Maven project?



Two ways of doing this:

1). If you understand the layout of the Maven repository, you can copy the jar directly into where it is meant to go. Maven will find this file next time it is run.

2). If you are not confident about the layout of the Maven repository, then you can adapt the following command to load in your jar file, all on one line.

mvn install:install-file  -Dfile=<path-to-file>  -DgroupId=<group-id>  -DartifactId=<artifact-id>  -Dversion=<version>  -Dpackaging=<packaging>  -DgeneratePom=trueWhere: <path-to-file>  the path to the file to load       <group-id>      the group that the file should be registered under       <artifact-id>   the artifact name for the file       <version>       the version of the file       <packaging>     the packaging of the file e.g. jar

This should load in the file into the Maven repository, renaming it as needed.