diff --git a/.travis.yml b/.travis.yml index 1e96d04..57318bf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,13 +7,13 @@ notifications: matrix: include: - jdk: openjdk6 - env: JACOCO=true COVERALLS=true + env: JACOCO=true - jdk: openjdk7 env: JACOCO=true COVERALLS=true - jdk: oraclejdk7 - env: JACOCO=true COVERALLS=true + env: JACOCO=true - jdk: oraclejdk8 - env: JACOCO=true COVERALLS=true + env: JACOCO=true - jdk: openjdk7 env: JACOCO=true GDMSESSION=sonar SONAR_ANALYSIS_MODE=publish script: mvn clean install -Dsonar.analysis.mode=publish --fail-at-end diff --git a/pom.xml b/pom.xml index 7b04a87..ef56f8f 100644 --- a/pom.xml +++ b/pom.xml @@ -322,7 +322,7 @@ - ci + jacoco env.JACOCO @@ -389,6 +389,7 @@ ${sonar.working.directory}/${sonar.report.export.path} + ${sonar.skip} ${project.basedir}/src/test/groovy/verify-sonar-issues.groovy diff --git a/src/test/groovy/verify-sonar-issues.groovy b/src/test/groovy/verify-sonar-issues.groovy index 0ca0f35..2440b53 100644 --- a/src/test/groovy/verify-sonar-issues.groovy +++ b/src/test/groovy/verify-sonar-issues.groovy @@ -1,15 +1,15 @@ import groovy.json.JsonSlurper -propertyName = 'sonar.issues.file' -filepath = new File(properties.getAt(propertyName)) -log.info('Sonar Issues file: ' + filepath) -if (!filepath.canRead()) { - log.warn('Cant read issues file: ' + filepath) - exit(0) +String skip = properties.getAt('sonar.skip') +if (skip == 'true') { + log.info('sonar.skip = true: Skipping Sonar issues file analysis.') + return; } - -def slurper = new JsonSlurper() -def contents = filepath.getText('UTF-8') +String issueFile = properties.getAt('sonar.issues.file') +filepath = new File(issueFile) +log.info('Sonar Issues file: ' + filepath) +JsonSlurper slurper = new JsonSlurper() +String contents = filepath.getText('UTF-8') def json = slurper.parseText(contents) def major = 0