SonarQube 'New Code' Criteria Triggered by Non-Code Changes

We are using a self-hosted version of SonarQube, specifically the Community Edition, version 9.9.1.

We have not made any changes to the Java code itself only modifications were made to the pom.xml file. However, SonarQube is failing on the “New Code” criteria, as it is detecting changes and considering them as new code.

Could you help us understand why the “New Code” is being detected even though no changes were made to the Java code? The changes were only made to the pom.xml file.

Hi,

Welcome to the community!

What were the changes to the pom? Did you switch out dependencies? Changing which libraries or library versions would cause a change to the compiled output which may indeed result in new issues.

 
Ann

We have added the maven-surefire-plugin in the pom.xml and one version change on the dependency and property section.

Can we exclude the pom.xml to be detected from sonar qube code coverage ?

I have tried by adding this file in the sonarqube ui in the administration setting under " Coverage Exclusions" and in the log it says that the pom.xml is excluded but still the code coverage is failing on on “New Code” criteria… As it is detecting it as a new code but no changes are made to any file other that pom.xml

Hi,

Coverage exclusions keep the files in question from being part of the test coverage metrics. What you want is a file exclusion, to keep the pom from being considered by analysis at all.

 
HTH,
Ann