Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.10.1
-
Fix Version/s: 1.11
-
Component/s: Maven Plugin
-
Labels:None
Description
After running successfully mvn sonar:sonar on a submodule then on the parent, mvn sonar:sonar fails with an NonUniqueResultException on the submodule.
Cause by org.sonar.batch.core.FinalizeSnapshotsJob.getPreviousLastSnapshot, which don't take care of depth and path to retrieve previous snapshot.
First run of sonar on the submodule create a snapshot for itself.
id created_at project_id parent_snapshot_id status islast scope qualifier root_snapshot_id version path depth
627 2009-09-22 10:04:43 7 NULL P 1 PRJ BRC NULL 1.0-SNAPSHOT 0
Run of sonar on the parent create a snapshot on the database for itself and all it submodule.
id created_at project_id parent_snapshot_id status islast scope qualifier root_snapshot_id version path depth
936 2009-09-22 20:29:23 1 NULL P 1 PRJ TRK NULL 1.0-SNAPSHOT 0
942 2009-09-22 20:29:36 7 936 P 1 PRJ BRC 936 1.0-SNAPSHOT 936. 1
When re-running sonar on the submodule, FinalizeSnapshotsJob.getPreviousLastSnapshot watch only on islast flag, and not for depth and islast.
And the request return the 2 snapshots, the one from the parent and the one from the submodule, causing the exception (session.getSingleResult()).
Way to reproduce:
- create a project with a submodule
- run mvn clean install sonar:sonar on the submodule (success)
- run mvn clean install sonar:sonar on the parent (success)
- run again mvn clean install sonar:sonar on the submodule (fail)
Issue Links
- depends upon
-
SONAR-721
Purge last snapshot on a Maven project which has became a Maven module
-