sonar.cpd.exclusions within Gradle ignored?

1,019 views
Skip to first unread message

andre.g...@gmail.com

unread,
Sep 14, 2017, 4:28:56 AM9/14/17
to SonarQube
Hi, 

We have version 6.5 (build 27846) of SonarQube running in our CI environment. I have some files in my Gradle-based java project, for which I would like to disable "duplicate code detection". According to the docs under [1], I can set a property called "sonar.cpd.exclusions" for this. I configured our build.gradle as follows:

apply plugin: 'java'
apply plugin: 'jacoco'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'org.sonarqube'
apply plugin: 'org.owasp.dependencycheck'

...

sonarqube {
    properties {
        property "sonar.projectKey", "<our project key>"
        property "sonar.projectName", "<our project name>"
        property "sonar.branch", branchName
        property "sonar.sourceEncoding", "UTF-8"
        property "sonar.exclusions", "**/*.css,**/*.js"
        property "sonar.cpd.exclusions", "<our path>/*.java"
    }
}


When I run a gradle build, it looks as if the "sonar.cpd.exclusions" property is not overriding default settings. Classes in that directory still get analyzed for duplicate code. What did I do wrong here? We run latest plugins on Sonar.

Thank you for any help,
André

G. Ann Campbell

unread,
Sep 14, 2017, 6:13:34 AM9/14/17
to SonarQube
Hi Andre,

(Sorry, my keyboard doesn't have accents.)

I believe that should work. Is it possible the problem is with "<our path>"? What happens if you use '**' instead?


Ann
Reply all
Reply to author
Forward
0 new messages