From 7877b3d7caaeb42088bff62c04d03bab3a83f078 Mon Sep 17 00:00:00 2001 From: nadiyarahilkhan <120252295+nadiyarahilkhan@users.noreply.github.com> Date: Sat, 2 Nov 2024 11:21:47 +0530 Subject: [PATCH] Create Jenkinsfile --- Jenkinsfile | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..85cc0fe --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,55 @@ +pipeline { + agent any + + environment { + JAVA_HOME = tool 'java11' // Jenkins Java tool setup name + MAVEN_HOME = tool 'Maven' // Jenkins Maven tool setup name + PATH = "${JAVA_HOME}/bin:${MAVEN_HOME}/bin:${env.PATH}" + } + + stages { + stage('Checkout') { + steps { + git url: 'git@github.com:amitopenwriteup/java11-examples.git', credentialsId: 'your-ssh-credentials-id' + } + } + + stage('Build') { + steps { + sh 'mvn clean compile' + } + } + + stage('Test') { + steps { + sh 'mvn test' + } + } + + stage('Package') { + steps { + sh 'mvn package' + } + } + + stage('Deploy') { + steps { + echo 'Deploying application...' + // Add deployment steps here (e.g., copy files, run scripts) + } + } + } + + post { + always { + echo 'Cleaning up...' + deleteDir() + } + success { + echo 'Pipeline completed successfully!' + } + failure { + echo 'Pipeline failed.' + } + } +}