Maven private repository in gitlab

Simple way how to use gitlab for a private maven repository.

Open your pom.xml and add repository information. For this example I used maven branch in project for maven repository.

add maven-deploy-plugin:

Assembled project will be saved next to your project in a folder named “${project.name}-mvn-repo

Full pom.xml:

Now run in console “mvn deploy

or in Idea:

Now go to generated folder “${project.name}-mvn-repo

Configure maven to use the repository.

Create or open in home directory .m2/settings.xml.  To access gitlab we need to add http header

you can get private token in this page https://gitlab.com/profile/account

Now, in another project, you can include your library.

 

Leave a Reply

Your email address will not be published. Required fields are marked *