Includes TSQL Analysis into Maven

How can I do for Sonar reads TSQL Files when run Maven Sonar?

Hello Carlos,

Are the TSQL files located under src/main? If so, you may simply need to adjust the value of the properties sonar.tsql.file.suffixes and sonar.plsql.file.suffixes to make sure your files are picked up appropriately. By default, the .sql file extension is associated with PL/SQL only.

You may also need to specify a value for the sonar.sources property if your TSQL files live outside of src/main. In this case be sure you include expressions to cover all of your source file locations, assuming there is more than just TSQL in this project.

Hope this helps!

I’ve already changed the extentions to .sql. My sql files are in the root of the java project.

What do I need to set in sonar.sources property to consider all my files, specially BD folder ?

This is my folder content…

And my database files are in BD folder


I think your struggle is that you’re using maven without a typical maven project structure, so you’re fighting the default values our scanner for maven pulls from the build.

If you want all of those folders to be included and don’t want to enumerate them, simply set sonar.sources to . so that the root-level folder is regarded as the location for sources. Or you could enumerate them, like sonar.sources=BD,Katalon,PayBacCommon etc. Then you can later fine-tune using sonar.exclusions if you don’t want some of the contents within those folders.

Note that you can set these values from within the pom.xml using properties, via the command-line using java property syntax like -Dsonar.sources=. or within a file that lives in the project root folder.