0 files indexed by sonar-scanner

Hello I am using SonarQube 7.9.5 Enterprise and have installed Sonar MB Precise plugin to run analysis on .esql files related to Message broker code. Whenever the scanner is executed through Jenkins pipeline, it always says:

WARN: SCM provider autodetection failed. Please use "sonar.scm.provider" to define SCM of your project, or disable the SCM Sensor in the project settings.
INFO: Branch name: null, type: short living
INFO: ============== getFileSuffixes() called ====================
INFO: conf
INFO: esql
INFO: subflow
INFO: msgflow
INFO: mset
INFO: mqsc
INFO: project
INFO: bpml
INFO: map
INFO: wsdl
INFO: descriptor
INFO: ============== getFileSuffixes() - dp called ====================
INFO: xsl
INFO: =========================================================
INFO: ===================== will process the following file types ===================================
INFO: conf
INFO: esql
INFO: subflow
INFO: msgflow
INFO: mset
INFO: mqsc
INFO: project
INFO: bpml
INFO: map
INFO: wsdl
INFO: descriptor
INFO: ========================================================
INFO: Indexing files...
INFO: Project configuration:
INFO: 0 files indexed

I have tried adding the sonar.scm.exclusions.disabled=true line to the sonar properties files looking at other threads, but still no luck. Is there anything that I am missing here. I must say that I am pretty new to using Sonar.

Hi,

Welcome to the community!

Ideally, you’ll figure out how to make this work rather than turning it off. Pulling the blame data from your SCM allows us to be more precise with identifying “new” code and assigning issue ownership. Do you (okay, Jenkins) check the code out from an SCM? And if so, are you running analysis from the SCM/checkout root directory?

And… if you can’t get this working, the toggle to turn off the functionality isn’t the one you tried (it was a decent try tho :smiley: ) it’s sonar.scm.disabled.

 
HTH,
Ann

Hello Ann,

Thanks for your reply. My pipeline is cloning a git repo to a jenkins machine and sonar scanner is running the scans on the root of the cloned directory. The root directory contains many directories holding mainly .esql, .bat, .xml , .java and .class files.

When I try to run the scan without excluding the java files directory, It is able to detect 80+ files , but, I get the error from scanner that it was not able to find compiled java binaries and to mention their path in sonar.java.binaries parameter. But even after providing the path in properties file, it fails with the same error.

Since my scanning focus is the MQ Broker code for which I have installed the MB Precise plugin, i made a choice to exclude the java code but then it detects 0 files in this case.

Hope this provides more clarity on my issue.

Hi,

First, which “same error” this thread starts with something about SCM detection. If you’ve tried providing the sonar.java.binaries value, then that sounds like a question of understainding where analysis is starting its path from versus what you’re providing.

This also sounds like a question of what you’re configuring versus what analysis “understands”.

At this point it may be simplest to change your sonar.sources value to point specifically and only to your MQ Broker code.

 
Ann

Hello Ann,

Tried to use the sonar.sources property but still if somehow is taking java files into account. Tried setting the sonar sources through both property file and at runtime but still facing same issue. Could you please share a sample windows sonar scanner command that will exclude all the .java and .class files and scan reminder.

Hi,

I think it’s time to try adding -Dsonar.scanner.dumpToFile=[file name] to your analysis command line so we can see the net property set analysis is getting.

 
Ann