Sometimes, projects analyzes raise issues on old code. We have this problem since long time.
And this problem came back last week on differents projects.
For example : 2 analyzes on the same project at 3 hours intervals.
Between theses analyses, only on file has changed : javascript file.
Sonarqube server not changed (no server update, no conf update,…)
The first analisys finished on PASSED with 0 issue. And the second finished on FAILED with many issues
It looks like in your first build, some dependencies failed to be resolved and that didn’t fail the build.
Downloading from thelem: http://pr.app.picrepo.grsea.priv:8081/repository/public/fr/thelem/upload/piece/upload-piece-service/2.13.1.2-SNAPSHOT/upload-piece-service-2.13.1.2-SNAPSHOT.jar
Downloading from thelem: http://pr.app.picrepo.grsea.priv:8081/repository/public/fr/thelem/upload/piece/upload-piece-service/2.13.1.2-SNAPSHOT/upload-piece-service-2.13.1.2-SNAPSHOT-tests.jar
[WARNING] The following dependencies could not be resolved at this point of the build but seem to be part of the reactor:
[WARNING] o fr.thelem.upload.piece:upload-piece-common:jar:2.13.1.2-SNAPSHOT (compile)
[WARNING] o fr.thelem.upload.piece:upload-piece-service:jar:2.13.1.2-SNAPSHOT (compile)
[WARNING] o fr.thelem.upload.piece:upload-piece-dao:jar:2.13.1.2-SNAPSHOT (compile)
[WARNING] o fr.thelem.upload.piece:upload-piece-service:jar:tests:2.13.1.2-SNAPSHOT (test)
[WARNING] o fr.thelem.upload.piece:upload-piece-dao:jar:tests:2.13.1.2-SNAPSHOT (test)
[WARNING] Try running the build up to the lifecycle phase "package"
The logs note later on:
[WARNING] Unresolved imports/types have been detected during analysis. Enable DEBUG mode to see them.
[WARNING] Use of preview features have been detected during analysis. Enable DEBUG mode to see them.
SonarQube relies on having the dependencies to perform an accurate scan, and they were missing here. I would recommend not letting your build continue if dependencies are missing.
You can get these issues to be backdated by following a rather sucky workaround.
Set an exclusion for the file(s) not backdated properly
Set sonar.dbcleaner.daysBeforeDeletingClosedIssues in your project’s Database Cleaner settings to 0, and reanalyze
Reanalyze code, removing the files from SonarQube and any issues associated with them
Remove the exclusion and reanalyze code. The issues. will now be backdated properly.
Or, if there have only been two analyses on the project: delete the project and start over.