diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..aa1e14c --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,53 @@ +#!groovy + +node { + currentBuild.result = "SUCCESS" + + try { + + stage('envset'){ + withEnv([ + "devopsName='Jenkins DevOps'", + 'emailTo=devopstrainingblr@gmail.com', + 'emailFrom=devopstrainingblr@gmail.com' + ]) + } + stage('Checkout'){ + + checkout scm + } + + stage('Compiling'){ + + sh 'mvn deploy' + } + + stage('Sonar') { + //add stage sonar + sh 'mvn sonar:sonar' + } + stage('mail'){ + + def subject = "${currentBuild.result}: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]'" + def summary = "${subject} (<${env.BUILD_URL}|Open>)" + def details = """

${currentBuild.result}: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]':

+

Error: ${errorMessage}

+

Check console output at "${env.JOB_NAME} [${env.BUILD_NUMBER}]"

""" + emailext recipientProviders: [[$class: 'DevelopersRecipientProvider']], subject: subject, body: details + } + + } + catch (err) { + + currentBuild.result = "FAILURE" + + def subject = "${currentBuild.result}: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]'" + def summary = "${subject} (<${env.BUILD_URL}|Open>)" + def details = """

${currentBuild.result}: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]':

+

Error: ${errorMessage}

+

Check console output at "${env.JOB_NAME} [${env.BUILD_NUMBER}]"

""" + emailext recipientProviders: [[$class: 'DevelopersRecipientProvider']], subject: subject, body: details + + throw err + } +} diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..37db247 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,15 @@ +# Root project information + +sonar.projectKey=org.bt +sonar.projectName=maven-web-job-dev +sonar.projectVersion=1.0 + + +# Some properties that will be inherited by the modules + +sonar.sources=src + + +# List of the module identifiers + +#sonar.modules=module1,module2