0


While building from my Parent module, the code coverage and sonar anslysis happens fine. Since Sonar does aggregation of code coverage of all sub modules.

However, When I build my sub-module for code coverage, the analysis is not updated back in my Parent project.

Is there a way to tweak the aggregation both ways, i.e. When Parent build happens or when an individual Module builds independently.
I don't want to run the whole parent project everytime, to capture the code coverage analysis in sonar.

My parent pom.xml consists of all sonar,jacoco configurations and other modules inherit them.

<sonar.jacoco.reportPaths>${project.basedir}/../target/*ut-jacoco.exec</sonar.jacoco.reportPaths>

And each module generates its own moduleX-ut-jacoco.exec.

DeludedPsyche
  • 131
  • 1
  • 2
  • 13
  • Make the sonar analysis on the root project `mvn clean install` and afterwards `mvn org.sonarsource.scanner.maven:sonar-maven-plugin:3.3:sonar`... – khmarbaise Dec 21 '17 at 12:08
  • mvn clean install sonar:sonar is what I am executing at present. – DeludedPsyche Dec 21 '17 at 14:07
  • I have suggest to make separate calls of it... – khmarbaise Dec 21 '17 at 15:39
  • Well, separate or together, didnt make any difference. M still not able to update the metrics while individually building my Module. – DeludedPsyche Dec 22 '17 at 05:49
  • Could this be a limitation of Sonar? Sonar analysis report mentions {"errorMessage":"Validation of project failed:\n o Component (uuid=AWB8h3BkPLNZb98uiZti, key=com.proj.main:Module1) is not a project\n o The project \"com.proj.main:MyModule1\" is already defined in SonarQube but as a module of project \"com.proj.main:PARENT\". If you really want to stop directly analysing project \"com.proj.main:PARENT\", please first delete it from SonarQube and then relaunch the analysis of project \"com.proj.main:Module1\"."} – DeludedPsyche Dec 22 '17 at 05:58

1 Answers1

0

Thanks @khmarbaise for guidance. It took a while to understand the behavior but its indeed a learning.

After Module is build with test-case execution using

mvn clean install

A separate sonr analysis is needed to be run on parent project.

mvn sonar:sonar

This subsequent sonar analysis helped me update coverage and other metrics on Parent porject as well as at Module level.

DeludedPsyche
  • 131
  • 1
  • 2
  • 13