Day 74: Nexus Repository Setup


In modern DevOps, artifact management is crucial. Today, I worked on setting up Nexus Repository and integrated it into my Jenkins Pipeline to store versioned build artifacts.
π Why Nexus Repository?
Nexus is a universal artifact repository manager. It allows us to:
β
Store build artifacts (JAR, WAR, Docker images).
β
Version control for builds.
β
Share artifacts across environments (QA β Staging β Prod).
β
Secure access using credentials.
βοΈ Jenkins Pipeline with Nexus Integration
Hereβs the pipeline I used for nexus setup:
pipeline {
agent any
tools {
maven "MAVEN3"
jdk "OracleJDK8"
}
stages{
stage("UploadArtifact"){
steps{
nexusArtifactUploader(
nexusVersion: 'nexus3',
protocol: 'http',
nexusUrl: '172.31.18.28:8081',
groupId: 'QA',
version: "${env.BUILD_ID}-${env.BUILD_TIMESTAMP}",
repository: 'vprofile-repo',
credentialsId: 'nexuslogin',
artifacts: [
[artifactId: 'vproapp',
classifier: '',
file: 'target/vprofile-v2.war',
type: 'war']
]
)
}
}
}
}
π οΈ Breakdown of Nexus Upload Stage
nexusArtifactUploader β Jenkins plugin to push artifacts to Nexus.
nexusVersion β Specifies Nexus 3.
credentialsId β Jenkins credentials for authentication.
groupId β Logical group for your artifacts (
QA
in this case).version β Uses Jenkins build ID + timestamp for versioning.
repository β Nexus repo name (
vprofile-repo
).artifacts β WAR file to upload.
π Why This Matters?
Every successful build gets uploaded to Nexus.
Builds are versioned automatically using Jenkins metadata.
QA/Dev teams can fetch exact builds for testing or deployment.
Prevents "works on my machine" issues by having one source of truth for artifacts.
Subscribe to my newsletter
Read articles from Shaharyar Shakir directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
