1

After integrating sonar qube into my maven multi-module build and running

mvn -U -B -Dmaven.test.failure.ignore -Psonar verify sonar:sonar

I see the following build times

[2023-01-06T17:00:17.831Z] [INFO] ------------------------------------------------------------------------
[2023-01-06T17:00:17.831Z] [INFO] Reactor Summary for my-project 1.0.1:
[2023-01-06T17:00:17.831Z] [INFO] 
[2023-01-06T17:00:17.831Z] [INFO] my-project ............................................ SUCCESS [01:52 min]
[2023-01-06T17:00:17.831Z] [INFO] my-project-common ..................................... SUCCESS [ 22.046 s]
[2023-01-06T17:00:17.831Z] [INFO] my-project-migration .................................. SUCCESS [  3.998 s]
[2023-01-06T17:00:17.831Z] [INFO] my-project-test-common ................................ SUCCESS [ 33.710 s]
[2023-01-06T17:00:17.831Z] [INFO] my-project-dto ........................................ SUCCESS [  3.010 s]
[2023-01-06T17:00:17.831Z] [INFO] my-project-producer ................................... SUCCESS [ 31.773 s]
[2023-01-06T17:00:17.831Z] [INFO] my-project-db ......................................... SUCCESS [01:07 min]
[2023-01-06T17:00:17.831Z] [INFO] my-project-utils ...................................... SUCCESS [ 23.637 s]
[2023-01-06T17:00:17.831Z] [INFO] my-project-server ..................................... SUCCESS [05:50 min]
[2023-01-06T17:00:17.831Z] [INFO] my-project-client ..................................... SUCCESS [ 32.758 s]
[2023-01-06T17:00:17.831Z] [INFO] my-project-http-client ................................ SUCCESS [  5.322 s]
[2023-01-06T17:00:17.831Z] [INFO] my-project-integration ................................ SUCCESS [02:43 min]
[2023-01-06T17:00:17.831Z] [INFO] jacoco-coverage-report ................................ SUCCESS [  8.389 s]
[2023-01-06T17:00:17.831Z] [INFO] my-project-other ...................................... SUCCESS [01:00 min]
[2023-01-06T17:00:17.831Z] [INFO] ------------------------------------------------------------------------
[2023-01-06T17:00:17.831Z] [INFO] BUILD SUCCESS
[2023-01-06T17:00:17.831Z] [INFO] ------------------------------------------------------------------------
[2023-01-06T17:00:17.831Z] [INFO] Total time:  15:22 min
[2023-01-06T17:00:17.831Z] [INFO] Finished at: 2023-01-06T17:00:17Z
[2023-01-06T17:00:17.831Z] [INFO] ------------------------------------------------------------------------

where the my-project .... build time of ~2 minutes took me by surprise.

Then on the console output I noticed the following

Building my-project 1.0.1 [15/14] 

i.e. It builds the 15th step out of 14.

Examining the output it seems this is an extra step added by sonar. But it re-uses the the top level pom.xml name masking it's build time and hiding its own.

Is this expected? Is there a workaround to avoid the override?

I'm also curious if there is a way to integrate sonar and run its analysis in parallel rather than sequentially at the end?

i.e. It could analyse the finished modules while the next module is being built in parallel.

Note: The integration is via jacoco

<plugin>
  <groupId>org.jacoco</groupId>
  <artifactId>jacoco-maven-plugin</artifactId>
  <version>0.8.5</version>
</plugin>
Shane Gannon
  • 6,770
  • 7
  • 41
  • 64
  • `I'm also curious if there is a way to integrate sonar and run its analysis in parallel rather than sequentially at the end?` can you explain that? And what does this: `where the my-project .... build time of ~2 minutes took me by surprise.`? Related to what? – khmarbaise Jan 11 '23 at 00:00
  • I have 14 submodules in my build. The sonar analysis runs after they've all been built, as a 15th step. I was hoping it could instead run against each module once it is finished. With the result of a faster completion time as I assume most the analysis time is sent on the server. – Shane Gannon Jan 11 '23 at 05:54
  • Normally `my-project ....` completes in 7 seconds. When sonar is included it overrides this module and replaces its build time with the sonar time in the "report". I'd find it more understandable if sonar added a new 15th module entry at the end. E.g. `my-project sonar ....` in the build time report printed at the end by maven. This would be easier to understand as it indicates when the sonar step executes, as the last step rather than the first. Until recently I thought the sonar analysis time was distributed across the modules, mostly due to the build time report. – Shane Gannon Jan 11 '23 at 06:01

0 Answers0