From 33dc0bc53789d5634d2812660d6cb3aae4916855 Mon Sep 17 00:00:00 2001 From: Bharanieeshwari <115724656+Bharanieeshwari@users.noreply.github.com> Date: Sun, 13 Aug 2023 16:06:11 +0530 Subject: [PATCH] Create Jenkins file --- Jenkins file | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 Jenkins file diff --git a/Jenkins file b/Jenkins file new file mode 100644 index 0000000..4354cbf --- /dev/null +++ b/Jenkins file @@ -0,0 +1,40 @@ +pipeline { + agent any + + stages { + stage('Checkout') { + steps { + checkout scm + } + } + + stage('Build and Test') { + steps { + script { + def mvnHome = tool name: 'Maven', type: 'hudson.tasks.Maven$MavenInstallation' + def mvnCmd = "${mvnHome}/bin/mvn" + sh "${mvnCmd} clean package" + } + } + } + + stage('Deploy to Tomcat') { + steps { + script { + def tomcatUser = 'your-tomcat-username' + def tomcatPassword = 'your-tomcat-password' + def tomcatUrl = 'http://your-tomcat-server:8080' + + def warFileName = 'MyWebApp.war' + def tomcatDeployDir = 'webapps/' + + def curlCommand = "curl -v -u ${tomcatUser}:${tomcatPassword} --upload-file target/${warFileName} ${tomcatUrl}/${tomcatDeployDir}" + + sh curlCommand + } + } + } + + // Add more stages as needed + } +}