I have a Java project and it will be submitted in Gitlab. In the code present in Gitlab, SonarQube will be used for its analysis. Currently the project is showing Code Smells with detail Classes from "sun.*" packages should not be used
.
How do I include the exclusion of this rule when my Maven Project is analysed by SonarQube?
What I go to know is that we have to put this in sonar-project.properties
. But I am not able to find what tag should be used for that.
In Maven projects, pom.xml
is the main configuration file. If we add below lines in that, the rule S1191
will not be applied. And this is in tight coupling with the project, which is what was required. So, no need to configure any SonarQube instance, rather specify below lines in pom.xml
under properties
tag. That will work.
<sonar.issue.ignore.multicriteria>e1</sonar.issue.ignore.multicriteria>
<sonar.issue.ignore.multicriteria.e1.ruleKey>squid:S1191</sonar.issue.ignore.multicriteria.e1.ruleKey>
<sonar.issue.ignore.multicriteria.e1.resourceKey>**/*.java</sonar.issue.ignore.multicriteria.e1.resourceKey>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With