Sonar.issue.ignore.multicriteria at module level is not supported anymore


(Lorenzo Bettini) #1

Hi
when using SonarQube 7.6, I get this warning when analyzing a multimodule project with Maven

[WARNING] Specifying issue exclusions at module level is not supported anymore. Configure the property ‘sonar.issue.ignore.multicriteria’ and any other issue exclusions at project level.

In my parent pom I have something like that

<sonar.issue.ignore.multicriteria>e11,e12</sonar.issue.ignore.multicriteria>
<sonar.issue.ignore.multicriteria.e11.ruleKey>squid:S00112</sonar.issue.ignore.multicriteria.e11.ruleKey
<sonar.issue.ignore.multicriteria.e11.resourceKey>**/SomeClass.java</sonar.issue.ignore.multicriteria.e11.resourceKey>
… similar for e12

I do not understand how to avoid the warning… how should I specify the multicriteria at project level?

thanks in advance
Lorenzo


(Lorenzo Bettini) #2

Anyone please?


(G Ann Campbell) #3

Hi,

You need to re-specify this at the project level with the path through the file system to what should be ignored. As a side note, you seem to have worked out how to do this outside the UI, but it’s easier to manage in the UI.

 
Ann


(Lorenzo Bettini) #5

Thank you Ann for your answer.

Actually I don’t want to use the UI since I want my Maven project to be configured so that when I switch to another Sonarqube installation (and Sonarcloud is just one of them) I don’t have to reconfigure anything.

I’m not sure I understand your solution… how should I modify this line in the POM? should I specify some relative path?

I’d want this configuration in the parent POM (as it is now) so that it applies to paths in all the Maven modules.

thanks in advance
Lorenzo


(Julien Henry) #7

Hi @LorenzoBettini

In Maven properties are inherited, so all modules will have this configuration. But the warning should only be displayed when:

  • we detect presence of such properties at module level
  • and the value of those properties is different than the parent (to ignore inheritance)

I don’t really know what is going wrong in your case, maybe your parent pom is not the parent in SQ (flat Maven layout maybe?).

I could investigate if you share a small reproducer, or alternatively you can also generate the scanner properties dump by running the same command as usual (like mvn sonar:sonar) with -Dsonar.scanner.dumpToFile=conf.properties.

Then open the generated file and remove any sensitive data (like all sonar.login/sonar.password) and please send it to me privately.


(Lorenzo Bettini) #8

Dear Julien

I specify multicriteria only in the parent POM (which is also the project in SonarQube and it does not rely on flat layout - though I’d expect flat layout not to be a problem, hopefully). I recreated the problem with a small project with a few modules. It consists of Eclipse plugin projects, build with Maven Tycho, but in the end, the POM is a Maven POM.

The project can be found here (only an example with no real code/tests that make sense): https://github.com/LorenzoBettini/tycho-sonarqube-example

I tested it locally and from Travis/SonarCloud: https://sonarcloud.io/dashboard?id=example%3Aexample.parent

I’ve also tried your command locally and the generated conf.properties contain lines of the shape (concerning multicriteria):

example\:example.plugin1.sonar.issue.ignore.multicriteria=e13
example\:example.plugin1.sonar.issue.ignore.multicriteria.e13.resourceKey=**/*Test.java
example\:example.plugin1.sonar.issue.ignore.multicriteria.e13.ruleKey=squid\:S2699
...
example\:example.plugin1.tests.sonar.issue.ignore.multicriteria=e13
example\:example.plugin1.tests.sonar.issue.ignore.multicriteria.e13.resourceKey=**/*Test.java
example\:example.plugin1.tests.sonar.issue.ignore.multicriteria.e13.ruleKey=squid\:S2699

In the parent POM I specify

<sonar.issue.ignore.multicriteria>e13</sonar.issue.ignore.multicriteria>

<sonar.issue.ignore.multicriteria.e13.ruleKey>squid:S2699</sonar.issue.ignore.multicriteria.e13.ruleKey>
<sonar.issue.ignore.multicriteria.e13.resourceKey>**/*Test.java</sonar.issue.ignore.multicriteria.e13.resourceKey>

Do you still need the whole conf.properties?

many thanks in advance
Lorenzo


(Julien Henry) #9

Hi @LorenzoBettini

Thanks for the reproducer. I have created a ticket and we will work on a fix:
https://jira.sonarsource.com/browse/SONAR-11850

Thanks again for reporting the issue.


(Lorenzo Bettini) #10

My pleasure.
Please let me know if I can further help :slight_smile: