I am currently trying to run sonarcloud scanning on a somewhat complicated project, which includes both multiple independent modules and multiple languages. I am able to use the maven SonarScanner to analyze the java components, or the GitHub Actions for Sonarcloud to scan the non-java components, but I have not yet been able to do both at once.
How should I configure this? Directory structure is equivalent to the following:
I have so far tried adding different settings for sonar.sources, or including the additional folders we want to scan as resources in the aggregate pomfile, but without luck.
Tech Stack:
- Github Actions
- JDK 11
Command Used:
mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=PROJECT_NAME
- Have also tried adding
-Dsonar.sources=relevantFolders
or-Dsonar.sources=.
to get it to pick up additional files, with the error reported below
Languages:
- Languages of the repository are Java (primarily), javascript/typescript, python, terraform
Errors:
- If using
sonar.sources=.
in command, error isjavaModule/pom.xml can't be indexed twice. Please check that inclusion/exclusion patterns produce disjoint sets for main and test files
- If using
sonar.sources=mixedFiles/typescriptFiles,pythonFiles,terraform
, error isThe directory '/home/runner/work/REPO_NAME/REPO_NAME/javaModule/terraform' does not exist for Maven module ***:javaModule:jar:1.0. Please check the property sonar.sources -> [Help 1]
- If not using sonar.sources property the scanner is able to run, but SonarCloud only scans Java components