diff --git a/Jenkinsfile.txt b/Jenkinsfile.txt index 84fff7f..818152f 100644 --- a/Jenkinsfile.txt +++ b/Jenkinsfile.txt @@ -4,12 +4,58 @@ pipeline { // *****ALL CODE TO BE ADDED BELOW THIS COMMENT***** - - - - - + //Code starts for stage Clean + stage('Clean') { + steps { + sh 'mvn clean' + } + } + + + //Code starts for stage PMD + stage('PMD') { + steps { + sh 'mvn site' + } + } + //Code ends for stage PMD + + + + //Code starts for stage Compile + stage('Compile') { + steps { + sh 'mvn compile' + } + } + //Code Ends for stage Compile + + stage('Static Code Analysis') { + steps { + script { + scannerHome = tool 'sonar-scanner' + } + withSonarQubeEnv('MySonarQubeServer') + { + sh "${scannerHome}/bin/sonar-scanner" + } + } + } + //Code ends for stage Static Code Analysis + + //Code starts for stage Unit Test + stage('Unit Test') { + steps { + sh 'mvn test' + } + post { + always { + junit 'target/surefire-reports/*.xml' + } + } + } + //Code ends for stage Unit Test // *****ALL CODE TO BE ADDED ABOVE THIS COMMENT***** } -} \ No newline at end of file +}