diff --git a/Jenkinsfile b/Jenkinsfile index c978297..7aa35ea 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,25 +1,22 @@ -pipeline { - agent any - stages { - stage('Checkout') { - steps { - echo 'Checkout completed' - } - } - stage('Static-test') { - steps { - echo 'Running static tests on code' - } - } - stage('Build') { - steps { - sh 'echo "Building the code"' - } - } - stage('Deploy') { - steps { - echo 'Deploying into environment' - } - } - } +pipeline{ + agent {label 'tomcat'} + stages{ + stage('Git Checkout Stage'){ + steps{ + git branch: 'main', url: 'https://github.com/Ravichandu-git/java-example.git' + } + } + stage('Build Stage'){ + steps{ + sh 'mvn clean install' + } + } + stage('SonarQube Analysis Stage') { + steps{ + withSonarQubeEnv('sonarqube-server') { + sh "mvn clean verify sonar:sonar" + } + } + } + } } diff --git a/pom.xml b/pom.xml index b586f6f..84a44b1 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 works.buddy.samples - works-with-heroku + ravi-works-with-jenkins 1.0 war