How to include custom library into maven local repository

If you’ve ever wondered whether you can upload your own libraries as a dependency using Maven, the answer is yes, you can. And it is really simple.

It’s a 2-step process.


Step 1

Navigate to your Maven project path in the command line and to upload a library, that’s the structure of the maven command:

mvn install:install-file
Using the template above, simply populate the fields that correspond to your library.
Dfile => the path to the file
groupdId, artifactId and version are entirely up to you.
Dpackaging => the package type, a.k.a. jar, war, etc.

Step 2

After you have specified a library to be included using the command above, you need to add the dependency into the dependencies tab.


After you have added it as a dependency, simply build the project using mvn package and boom, you have added a custom library to your Maven project.

2 2 votes
Article Rating
Inline Feedbacks
View all comments