Instructions to push Java libraries to Nexus Repository

Tram Ho

Today I write a tutorial to push 1 library I wrote to this repository to archive After installing nexus, the system automatically creates repositories for us to use.

I’m only interested in 3 main repositories maven-public maven-release maven-snapshots

To be able to build and automatically increase the version of the library, we need a repository to store code, in this example I created on git to publicize for all users according to the link.

Mainly config on pom.xml Add 1 scm, note the path above this will be your git repository path

add maven build plugins

Declare distribution management to know where to push the library it is the path to everyone’s Nexus.

Still do not see security anywhere. This will be saved in settings.xml in test item

With the content as below, containing the username and password of your nexus, since I have 2 repository releases and snapshots, I should declare 2 information as below, details of each post will be explained in the following post to help save some trouble.

Finally, build, go to your project directory, type maven’s build command, wait and see the results.

There will be 1 log number as follows

The results I build version 1.4 on nexus check on nexus

we have a library

Looks like what I usually get on the maven repository, but you still can not use it because it is on your repo and is secure, your repos are not visible to everyone. How could the maven know to find it?

In the next post, I will write config instructions and use this library guy. Thanks for reading, if you have questions, please comment below.

Share the news now

Source : Viblo