Github Actions with Sonarqube for Java and Golang

Hi, I was wondering if anyone knew how I would go by setting up Github actions with SonarQube for both Java and Golang in a single repository. I’ve been able to set it up for either Java or Golang but I can’t get it to work for both at the same time.

Here is my example repository for this: GitHub - lfreixial/maven-testing

I also have the issue where in SonarQube its only showing one language and not every file in the repository for example at the moment it will only show the java files that are under the src folder.

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    SonarQube with Github Actions

  • what are you trying to achieve*
    getting sonarqube (and code coverage) with both Java and Golang in the same project

  • what have you tried so far to achieve this
    Followed the tutorial, made separate yml but when I use the “other” section it doesn’t like the java files and the maven section doesn’t read the go files

Thanks!

You’ll want to add something like this to your pom.xml to capture files outside what Maven considers the source files.

<properties>
        <sonar.sources>src/main/java,src/main/golang</sonar.sources>
</properties>

Hi Colin!, would this also analysis the go files? as I’m assuming this is for the maven workflow? I’ve been trying to use the “Other” workflow as i’ve gotten as far as complaining the Java with maven but then I get this message

Maven project detected. You should run the goal ‘org.sonarsource.scanner.maven:sonar’ during build rather than using this GitHub Action.

Thanks!

Hey there.

  • You can’t use SonarSource/sonarqube-scan-action with maven projects to analyze Java code
  • Running the Maven scanner with the changes to sonar.sources mentioned previously will analyze the Go code

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.