Installing an artifact to a specific local repository path

General information about how to copy jars into your local repository can be found in the Guide to installing 3rd party JARs

By default, the Apache Maven Install Plugin uses the local repository defined in the settings.xml to install an artifact.

You could install an artifact on a specific local repository by setting the localRepositoryPath parameter when installing.

mvn org.apache.maven.plugins:maven-install-plugin:3.1.1:install-file  -Dfile=path-to-your-artifact-jar \
                                                                              -DgroupId=your.groupId \
                                                                              -DartifactId=your-artifactId \
                                                                              -Dversion=version \
                                                                              -Dpackaging=jar \
                                                                              -DlocalRepositoryPath=path-to-specific-local-repo

Note: By using the fully qualified path of a goal, you're ensured to be using the preferred version of the maven-install-plugin. When using mvn install:install-file its version depends on its specification in the pom or the version of Apache Maven.