Skip to content

dsf configure nexus

travis edited this page Dec 20, 2019 · 2 revisions

Nexus Configuration

In this document you will see how you can configure Nexus repository and how to integrate it with jenkins.

Login in Nexus

The first time you enter in Nexus you need to log in with the user 'admin' and the password that is inside the path: /volumes/nexus/nexus-data Then you can change that password and create a new one.

Prerequisites

Repositories

You need to have one repository for snapshots, another for releases and another one for release-candidates. Normally you use maven2 (hosted) repositories and if you are going to use a docker registry, you need docker (hosted) too.

To create a repository in Nexus go to the administration clicking on the gear icon at top menu bar. Then on the left menu click on Repositories and press the Create repository button.

nexus create repository

Now you must choose the type of the repository and configure it. This is an example for Snapshot:

nexus create repository form

Create user to upload/download content

Once you have the repositories, you need a user to upload/download content. To do it go to the administration clicking on the gear icon at top menu bar. Then on the left menu click on Users and press the Create local user button.

nexus create user

Now you need to fill a form like this:

nexus create user form

Jenkins integration

To use Nexus in our pipelines you need to configure Jenkins.

Customize jenkins

The first time you enter jenkins, you are asked fot the pluggins to be installed. We select install suggested plugins and later we can add the plugins that we need depending on the project necessities.

plugins jenkins

Then we need to create our first admin user, we can do it like this:

jenkins first admin user

The next step is the jenkins URL:

jenkins url

Your jenkins setup is ready!

Add nexus user credentials

First of all you need to add the user created in the step before to Jenkins. To do it (on the left menu) click on Credentials, then on System. Now you could access to Global credentials (unrestricted).

nexus jenkins credentials

Enter on it and you could see a button on the left to Add credentials. Click on it and fill a form like this:

nexus jenkins credentials form

Add the nexus user to maven global settings

In order to do this, you will need the Config File Provider plugin so we need to download it.Go to Jenkins→Manage jenkins→Manage plugins and "available" tab and search for it:

jenkins config fp

Click on "Download now and install after restart".

Now you need to go to Manage Jenkins clicking on left menu and enter in Managed files.

Click on Add a new config/Global Maven settings.xml, change the id for a new one more readable:

jenkins maven settings

Then click on "Submit"

jenkins global maven

Edit the Global Maven settings.xml to add your nexus repositories credentials(the ones you created before) as you could see in the next image:

nexus jenkins global maven form

And you are done.

Clone this wiki locally