Sometimes the requirement comes when you have to use a third party plugin in your project which is not present in any public repositories. In such a scenario it is advised to deploy this jar file into your repository and then use it as a normal dependency in your Maven project.
This is helpful as the jar file becomes available to a lot of projects in future and if any further development work on the same project is done in future, then the dependency is resolved easily.
It's just a matter of running a maven command and you are ready to go. In case you want to install this plugin into your local repository(.m2 folder) then the command would be different from the normal deployment into your public repository.
For Local Maven Repository(.m2 folder):
mvn install:install-file -Dfile=<path to the jar file> -DgroupId=<groupId you want to provide> -DartifactId=<Unique name of the plugin> -Dversion=<version of the plugin you want to deploy> -Dpackaging=jar -DlocalRepositoryPath=<path to your local .m2 folder>
For Public Repository:
mvn deploy:deploy-file -Dfile=<path to the jar file> -DgroupId=<groupId you want to provide>-DartifactId=<Unique name of the plugin> -Dversion=<version of the plugin you want to deploy> -Dpackaging=jar -DrepositoryId=<id of your public repository> -Durl=<URL of the public repository where you want to deploy the jar file>
That finishes your job. You are ready to go now. Now you can use this as a normal dependency in your project and build your project.