How to ignore rule in one subproject (using gradle)

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    SonarQube 8.6

  • what are you trying to achieve
    A small helper console application is writing System.out.println. This is for this specific Java sub-project accepted, but not in all other projects in the repo.
    I want to disbale rule java:S106 in the gradle build of this project whereas in all other projects of the multi-project gradle build it should be kept enabled.

  • what have you tried so far to achieve this
    In the build.gradle file of this sub-project the following lines have been added:

    sonarqube {
      properties {
        property "sonar.issue.ignore.multicriteria", "s106"    
        property "sonar.issue.ignore.multicriteria.s106.ruleKey", "java:S106"
        property "sonar.issue.ignore.multicriteria.s106.resourceKey", "src/main/java/client/*.java"


Are you really saying you want to disable this in analysis configuration? As opposed to… (at all?) in the UI?

Because what you want is multiple criteria issue exclusion which is a real pain to set up as properties…


Hi @ganncamp

yes, for a small application (intended as example of library integration) a command line UI is sufficient. Unfortunately, S106 will complain on this simplistic useage with System.out.println.
In all code for delivery (e.g. the library) for sure this rule should be active.

Up to now, I put several @SuppressWarnings("java:S106") in the source. While SonarQube is happy therewith, Eclipse now warns on unsupported suppress warnings.

That’s why I wanted in the example project (and only there) to configure the suppression in the build skript.

Project layout:

|- gradle
|- buildSrc
|- library-A (Java only)
|- library-B (Java only)
|- library-C
\- example application (Java+Protobuf) <- only here S106 should be suppressed


I would really recommend you set these exclusions through the SonarQube UI.