Nexus + Jenkins
To integrate Nexus with Jenkins, you can follow these steps:
Install the Nexus Artifact Uploader plugin:
Access the Jenkins web interface.
Click on "Manage Jenkins" in the left-hand side menu.
Select "Manage Plugins" from the dropdown.
Navigate to the "Available" tab.
Search for "Nexus Artifact Uploader" in the filter box.
Check the box next to "Nexus Artifact Uploader" plugin.
Click on the "Install without restart" button.
Configure Nexus credentials in Jenkins:
Go back to the Jenkins dashboard.
Click on "Manage Jenkins" in the left-hand side menu.
Select "Manage Credentials" from the dropdown.
Click on "Global" or "System" depending on your Jenkins configuration.
Click on "Add Credentials".
Fill in the necessary information, such as the Nexus username and password.
Click on the "OK" button to save the credentials.
Configure the Nexus server in Jenkins:
Go back to the Jenkins dashboard.
Click on "Manage Jenkins" in the left-hand side menu.
Select "Configure System" from the dropdown.
Scroll down to the "Nexus Artifact Uploader" section.
Click on the "Add Nexus Server" button.
Provide a name for the Nexus server.
Enter the Nexus server URL (e.g., http://localhost:8081/nexus).
Select the Nexus credentials you configured in the previous step.
Click on the "Test Connection" button to ensure Jenkins can connect to Nexus successfully.
Click on the "Save" button.
Create a new Jenkins job:
On the Jenkins dashboard, click on "New Item" on the left-hand side.
Enter a name for your job and select the appropriate project type (e.g., Freestyle project, Maven project).
Click "OK" to proceed.
Configure the job:
Source Code Management: Select the appropriate SCM (e.g., Git, Subversion) and configure the repository details.
Build section: Add build steps as per your project requirements.
Post-build Actions: Click on the "Add post-build action" dropdown and select "Deploy artifacts to Nexus".
Nexus Server: Choose the Nexus server you configured in step 3.
Group ID, Artifact ID, Version, Packaging: Specify the details of the artifact you want to deploy.
Additional options: Configure any additional options, such as repository ID or classifier.
Save the job configuration.
Build the job:
On the Jenkins dashboard, click on the job name to navigate to its details page.
Click on "Build Now" to trigger the build.
Jenkins will now build your project and deploy the artifacts to Nexus as specified in the job configuration. You can view the build output, check the build status, and access other features provided by Jenkins for continuous integration and delivery.
By integrating Nexus with Jenkins, you can easily publish and manage your build artifacts, promote them across repositories, and ensure artifact consistency and traceability in your development and deployment processes.
Last updated