diff --git a/cicd/jenkins-pipelines/build.groovy b/cicd/jenkins-pipelines/build.groovy
index 1e0f6aa0a..675d50d0b 100644
--- a/cicd/jenkins-pipelines/build.groovy
+++ b/cicd/jenkins-pipelines/build.groovy
@@ -4,14 +4,16 @@ pipeline {
pollSCM('H/5 * * * *') // Watches the `dev` branch
}
environment {
- DOCKERHUB_CREDENTIALS = credentials('nalexx6-dockerhub-pass')
+ DOCKERHUB_CREDENTIALS = credentials('nalexxgd-docker-pass')
DOCKERHUB_USERNAME = "nalexxgd"
NEXUS_URL = 'localhost:8081'
+ ARTIFACT_VERSION = sh(script: "mvn help:evaluate -Dexpression=project.version -q -DforceStdout", returnStdout: true).trim()
+
}
stages {
stage('Checkout Code') {
steps {
- git url: 'git@github.com:Nalexx06/spring-petclinic.git', credentialsId: "nalexx06_github_ssh", branch: 'dev'
+ git url: 'https://github.com/spring-projects/spring-petclinic.git', branch: 'main'
}
}
@@ -22,15 +24,23 @@ pipeline {
}
stage('Upload to Nexus') {
steps {
- sh './mvnw deploy -DaltDeploymentRepository=snapshots::default::${NEXUS_URL}'
+ sh """
+ mvn deploy:deploy-file \\
+ -DgroupId=org \\
+ -DartifactId=petclinic \\
+ -Dversion=${ARTIFACT_VERSION}\\
+ -Dpackaging=jar \\
+ -Dfile=./target/spring-petclinic-${ARTIFACT_VERSION}.jar \\
+ -DrepositoryId=maven-snapshots \\
+ -Durl=http://${NEXUS_URL}/repository/maven-snapshots/ --settings settings.xml
+ """
}
}
stage('Build Docker Image') {
steps {
script {
- def version = sh(script: "mvn help:evaluate -Dexpression=project.version -q -DforceStdout", returnStdout: true).trim()
- sh "docker build -t petclinic:${version} ."
- sh "docker tag petclinic:${version} ${DOCKERHUB_USERNAME}/petclinic:${version}"
+ sh "docker build -t petclinic:${ARTIFACT_VERSION} ."
+ sh "docker tag petclinic:${version} ${DOCKERHUB_USERNAME}/petclinic:${ARTIFACT_VERSION}"
sh "docker login -u ${DOCKERHUB_USERNAME} -p ${DOCKERHUB_CREDENTIALS}"
sh "docker push ${DOCKERHUB_USERNAME}/petclinic:${version}"
}
diff --git a/pom.xml b/pom.xml
index 9b9b815df..dc6b8e722 100644
--- a/pom.xml
+++ b/pom.xml
@@ -331,6 +331,14 @@
Spring Milestones
https://repo.spring.io/milestone
+
+
+ false
+
+ mvn-central
+ MVN central
+ https://mvnrepository.com
+
diff --git a/settings.xml b/settings.xml
new file mode 100644
index 000000000..93b13df90
--- /dev/null
+++ b/settings.xml
@@ -0,0 +1,14 @@
+
+
+
+ maven-releases
+ admin
+ admin
+
+
+ maven-snapshots
+ admin
+ admin
+
+
+