First of all, here is my setup, upgraded just yesterday to the latest LTS so that I can use SonarJS:
- SonarQube Community 7.9.4 LTS
- sonar-scanner 18.104.22.1684
- sonar-maven-plugin 22.214.171.1246
- SonarJS 6.2.1
- Java Code Quality and Security 6.3.2
The project is structured with Maven modules all listed in the POM:
For two years, I’ve been launching manual as well as scheduled automated analyses with this command:
mvn clean jacoco:prepare-agent verify jacoco:report sonar:sonar -Dsonar.host.url=http://localhost:9999 -Dsonar.login=<token> -P test-coverage
The SonarQube UI is configured (in Administration > General settings > Analysis scope) to include files with extensions java, js, css and html.
Note that we have other projects that are JS libraries that I’ve started analyzing just yesterday. The command I used was
since these were one-module and one-language projects. I also added a
sonar-project.properties file, which contains the project key and name, to each library. Everything went fine for those projects.
Unfortunately, I have tried doing the same for the portal-frontend module, on a cloned SonarQube instance and I realize that I can’t do that because using the key and name of its parent project with sonar-scanner (second command listed above) seems to reset the project stats:
- existing duplications are no longer visible
- the quality profile that we use for Java is no longer listed among profiles applied to the project
- the project no longer contains Java in its language list
I’m thinking only a global analysis of the multimodule project can provide a unified view of the project as I started hoping for when I read this blog post.
My problem is that when using sonar-maven-plugin on the root Maven project, web files (JS, CSS and HTML) are simply ignored in the portal-frontend module. I get this on my screen:
No CSS, PHP, HTML or VueJS files are found in the project. CSS analysis is skipped.
Am I missing some configuration options? Or is it that my understanding of how things work is flawed?