diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..e6daf6b --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,23 @@ + +pipeline{ + agent {label 'sonar'} + stages{ + /*stage('Git Checkout Stage'){ + steps{ + git branch: 'main', url: 'https://github.com/tranju664/Sonar-Qube-war-example.git' + } + }*/ + stage('Build Stage'){ + steps{ + sh 'mvn clean install' + } + } + stage('SonarQube Analysis Stage') { + steps{ + withSonarQubeEnv('sonardemo') { + sh "mvn clean verify sonar:sonar -Dsonar.projectKey=sonardemo" + } + } + } + } +} diff --git a/pom.xml b/pom.xml index 1a1862c..c9f3f31 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ com.example jenkins-test - 1.0 + 1.1 jenkins-test Demo for jenkins diff --git a/readme b/readme index 5f78d2c..ce2ebca 100644 --- a/readme +++ b/readme @@ -1,3 +1,6 @@ Java code for sprint boot application Test -adding \ No newline at end of file +adding +pollscm +git-webhook +yes added