buildscript { repositories {} dependencies { classpath 'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.8' } } apply plugin: 'war' //apply plugin: 'ear' apply plugin: 'groovy' apply plugin: "jacoco" apply plugin: "pmd" apply plugin: "org.sonarqube" sourceSets { test { java { srcDirs = [ 'src/test/java', 'src/test-integration/java' ] } resources { srcDirs = [ 'src/test/resources', 'src/test-integration/resources' ] } } } sourceCompatibility = 1.7 targetCompatibility = 1.7 jacocoTestReport { dependsOn test // tests are required to run before generating the report reports { xml.enabled true // html.destination "${buildDir}/jacocoHtml" } } test { finalizedBy jacocoTestReport } pmd { ignoreFailures true } tasks['sonarqube'].dependsOn test sonarqube { properties { property "sonar.projectName", rootProject.name property "sonar.projectDescription", rootProject.name property "sonar.projectVersion", "${archiveVersion}" property "sonar.language", "java" property "sonar.junit.reportsPath", "${buildDir}/reports" property "sonar.java.coveragePlugin", "jacoco" property "sonar.jacoco.reportPath", "${buildDir}/jacoco/test.exec" // Note this property has been deprecated, you should use the sonar.coverage.jacoco.xmlReportPaths property below instead property "sonar.coverage.jacoco.xmlReportPaths", "${buildDir}/reports/jacoco/test/jacocoTestReport.xml" property "sonar.binaries", "${buildDir}/classes" property "sonar.sourceEncoding", "UTF-8" property "sonar.host.url", "xxxxxxxxxxxx" property "sonar.exclusions", "**/reports/**" property "sonar.dynamicAnalysis", "reuseReports" } }