Hi, we have a repository which contains Java, Js, Json & Yml files in same folders. Some of the folders have mixed type files. The main language is Java and we are using gradle so I was running sonar-scanner using gradle. It does scans all the Java files but it does not scan any other file.
For example (this is just 1 folder structure of the project)
I found out that I need to define the folders in sonar.sources property in build.gradle file but that threw an error that Java files can not be indexed twice. I tried then specifying file js file path individually which worked but I have a lot of js files and I can not enter all of their paths manually. I also can not use wildcards in gradle properties.
My question is that is there any better way I can scan all Java, Js and other files in our project using sonar-scanner?
Hmm… sounds like your definition was somehow additive. Given your structure, I would try a full override on the analysis commandline: -Dsonar.sources=.
Would you like to provide your full configuration list and/or your analysis log? You can find the full configuration list on the Background Tasks page, under the cog menu. Obviously, you’ll want to redact sensitive values.
For some reason I don’t have any failed attempts in the Background Tasks page you mentioned even though I just made a failed attempt but they are not being uploaded to sonarcloud.
Here is the error I have right now (this comes when I add sonar.sources=. to config)
Even if I change the sonar.sources at the module 1 level it still throws the same error. These are the updates I made. I tried writing full absolute path and relative path and both returned the same error.
Just to clarify these are the addresses for module 1 & module 2 and then gradle file is in the same project folder:
Module 1: project-folder/api
Module 2: project-folder/module2 (calling it module 2 to make it easier)
Gradle build file: project-folder/build.gradle
What I don’t understand is that if I define sonar.sources at module 1 level then wouldn’t it completely skip scanning module 2 folder?
The only thing which works is if I define path to all the js files in sonar.sources one by one.