= 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. image::./images/configuration/nexus-create-repository.png[] Now you must choose the type of the repository and configure it. This is an example for Snapshot: image::./images/configuration/nexus-create-repository-form.png[] == 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. image::./images/configuration/nexus-create-user.png[] Now you need to fill a form like this: image::./images/configuration/nexus-create-user-form.png[] == 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. image::./images/configuration/plugins-jenkins.png[] Then we need to create our first admin user, we can do it like this: image::./images/configuration/jenkins-first-admin-user.png[] The next step is the jenkins URL: image::./images/configuration/jenkins-url.png[] 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)_*. image::./images/configuration/nexus-jenkins-credentials.png[] Enter on it and you could see a button on the left to *_Add credentials_*. Click on it and fill a form like this: image::./images/configuration/nexus-jenkins-credentials-form.png[] === 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: image::./images/configuration/jenkins-config-fp.png[] 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: image::./images/configuration/jenkins-maven-settings.png[] Then click on *"Submit"* image::./images/configuration/jenkins-global-maven.png[] 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: image::./images/configuration/nexus-jenkins-global-maven-form.png[] And you are done.