All Java files excluded

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    SonarQube Enterprise 8.9 LTS
  • what are you trying to achieve
    Use sonnar scanner to scan all java files in the Jenkins build
  • what have you tried so far to achieve this
    I have specifically set sonar.exclusions to none so that it will not exclude any files, see my property file:


In jenkins log:

INFO: Pull request 43 for merge into develop from task/SPHINX-93
INFO: SCM collecting changed files in the branch
INFO: SCM collecting changed files in the branch (done) | time=87ms
INFO: Indexing files…
INFO: Project configuration:
INFO: Excluded sources: /*.java
INFO: Included tests: /*.java
INFO: 311 files indexed
INFO: 663 files ignored because of inclusion/exclusion patterns
INFO: 352 files ignored because of scm ignore settings
INFO: Quality profile for java: Sonar way
INFO: Quality profile for js: Sonar way
INFO: Quality profile for xml: Sonar way

I also tried to pull the source right before the sonar scanner cli run to ensure all java files are present in the cwd, but all java files are still excluded. Any suggestions?


Your analysis properties identify all java files as both test files (sonar.tests=.;sonar.test.inclusions=**/*.java) and as source files (sonar.sources=.). Perhaps you can understand that that causes a bit of confusion.

TBH, I’m not quite sure what’s going on with your exclusions, but you should start by dropping this analysis parameter. Then narrow your sonar.sources and sonar.tests parameters to only the correct paths. And come back to us if there’s still a problem after that.