Code Inclusion for mvn sonar scanned project

I have a project that was scanned with Automated (github) integration, and now is being scanned via CI (circleci).
When viewing the Automated project in Sonarcloud, I can see all the languages for code that are in the repo (see screenshot) for example: Java, CSS, YAML, XML, etc…
but when I via the CI scanned project, I only see Java/XML (other screenshot)


the CI command is:

mvn clean verify sonar:sonar \
    -Dsonar.organization=${SONAR_ORGANIZATION} \
    -Dsonar.host.url=${SONAR_HOST} \
    -Dsonar.branch.name=${CIRCLE_BRANCH} \
    -Dsonar.login=${SONAR_LOGIN} \
    -Dsonar.qualitygate.wait=true \
    -Dsonar.junit.reportPaths="target/surefire-reports" \
    -Dsonar.coverage.jacoco.xmlReportPaths="target/site/jacoco/jacoco.xml" 

and we’ve tried adding:

-Dsonar.inclusions=**/*.java, **/*.xml, **/*.html, **/*.css, **/*.yaml, **/*.js, **/*.sql 

to the ci, and also in the parent level pom.xml, but not seeing any results from these changes. Is there some other settings somewhere that might be restricting this?

Hey there!

Try enabling sonar.maven.scanAll.

ok, I tried that and it didn’t work. But that lead me down a better path of investigation, where I found that

  1. we were using an older maven plugin version that didn’t use that scanAll flag
  2. the inclusion/source params can be tweaked to work for multi-module: java - sonar-maven-plugin: extending sonar.sources in multi-module project - Stack Overflow
    • sonar.sources to be .
    • sonar.inclusions to be src/main/**

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.