Marco Baumeler
Marco Baumeler

Reputation: 101

Sonarqube groovy plugin doesn't pickup source files

We have mixed java / groovy projects managed with maven. On the Sonarqube side, we are using Sonarqube version 6.7.3 with the groovy plugin version 1.5 installed.

Our projects has the following folder structure:

/src
   /main
      /java
      /groovy
   /test
      /java
      /groovy

With that setup, the groovy files in the /src/main/groovy and /src/test/groovy are not picked up by Sonarqube. If we move the same files in the the /src/main/java folder, they get picked up.

Is there a setting so we can keep this folder structure?

Thanks

Upvotes: 0

Views: 1426

Answers (2)

Marco Baumeler
Marco Baumeler

Reputation: 101

Thanks to @Mike W 's answer I got further.

As our builds are maven based, we need to add the sonar.source property to the pom.xml:

<sonar.sources>pom.xml,src/main,src/test</sonar.sources>

Unfortunately this option is not available in the settings UI.

Other problem is that if one of the folders in this list doesn't exists, the analysis fails. As we have projects that have groovy code in it and others not we cannot put this configuration into the parent pom at the same place than the serverUrl.

For the moment, it seems that the only way to handle this is to define the the sonar.sources properties in each project where not only Java code is used.

Upvotes: 0

Mike W
Mike W

Reputation: 3932

You can add the paths to your sonar-project.properties file in the root of your app's source directory e.g.

sonar.sources=src/main/groovy,src/test/groovy

Docs here

Upvotes: 1

Related Questions