= Jenkins - Nexus integration Nexus is used to both host dependencies for devonfw projects to download (common Maven ones, custom ones such as `ojdb` and even devonfw so-far-IP modules). Moreover, it will host our projects' build artifacts (`.jar`, `.war`, ...) and expose them for us to download, wget and so on. A team should have a bidirectional relation with its Nexus repository. == 1. Jenkins credentials to access Nexus By default, when Nexus is installed, it contains 3 user credentials for different purposes. The admin ones look like this: `admin/admin123`. There are also other 2: `deployment/deployment123` and `TODO`. // ADD USER TABLE IMAGE FROM NEXUS In this case, let's use the ones with the greater permissions: `admin/admin123`. Go to `Credentials > System` (left sidebar of Jenkins) then to `Global credentials (unrestricted)` on the page table and on the left sidebar again click on `Add Credentials`. This should be shown in your Jenkins: image::./images/others/jenkins-nexus/jenkins-new-nexus-credentials.png[] Fill the form like this: image::./images/others/jenkins-nexus/jenkins-new-nexus-credentials-filled.png[] And click in OK to create them. Check if the whole thing went as expected: image::./images/others/jenkins-nexus/jenkins-new-nexus-credentials-completed.png[] == 2. Jenkins Maven Settings Those settings are also configured (or maybe not-yet-configured) in our *devonfw distributions* in: ``` /${devonfw-dist-path} /software /maven /conf settings.xml ``` Go to `Manage Jenkins > Managed files` and select `Add a new Config` in the left sidebar. image::./images/others/jenkins-nexus/jenkins-new-maven-settings.png[] The ID field will get automatically filled with a unique value if you don't set it up. No problems about that. Click on `Submit` and let's create some Servers Credentials: image::./images/others/jenkins-nexus/jenkins-new-maven-settings-servers.png[] Those *Server Credentials* will allow Jenkins to access to the different repositories/servers that are going to be declared afterwards. Let's create 4 server credentials. * `my.nexus`: Will serve as general profile for *Maven*. * `mynexus.releases`: When a `mvn deploy` process is executed, this will tell *Maven* where to push *releases* to. * `mynexus.snapshots`: The same as before, but with *snapshots* instead. * `mynexus.central`: Just in case we want to install an specific dependency that is not by default in the Maven Central repository (such as `ojdbc`), Maven will point to it instead. image::./images/others/jenkins-nexus/jenkins-new-maven-settings-servers-credentials.png[] A more or less complete Jenkins Maven settings would look look like this: [source,xml] ---- mynexus.central central central http://${URL-TO-YOUR-NEXUS-REPOS}/central my.nexus mynexus.releases mynexus Releases http://${URL-TO-YOUR-NEXUS-REPOS}/releases true always false always mynexus.snapshots mynexus Snapshots http://${URL-TO-YOUR-NEXUS-REPOS}/snapshots false always true always public Public Repositories http://${URL-TO-YOUR-NEXUS}/nexus/content/groups/public/ true always true always my.nexus ---- == 3. Use it in Jenkins Pipelines