snapshotGroup = manager.find(SnapshotGroup.class, groupId);
if (snapshotGroup == null) {
throw new NoResultException();
}
} else {
SnapshotGroupService service = new SnapshotGroupService(manager);
MavenProject parent = sonarProject.getParent();
int maxDept = 100;
while (maxDept > 0) {
if (parent.getParent() == null) {
break;
}
parent = parent.getParent();
maxDept--;
}
// look for the last snapshot group created within the last 60 mins
snapshotGroup = service.getLastUnprocessedGroup(parent.getId(), (long) 60 * 60 * 1000, runDate.getTime());
}
}
} catch (NoResultException e) {
throw new MojoExecutionException("Unable to find the last snapshot group");