42

I am setting up Sonar for one of my projects which is a mix of Groovy and Java. I am able to configure the project separately for either of these languages but not together. Is there any way to do this? I tried this

sonar.language = java,grvy

but didnt work

Vishal Yadav
  • 3,642
  • 3
  • 25
  • 42
rajesh
  • 3,247
  • 5
  • 31
  • 56

3 Answers3

52

UPDATE April 14th, 2014:

Starting with SonarQube 4.2, multi-language projects are supported.

This automatically happens when sonar.language is not set.

See my sample project here: https://github.com/bellingard/multi-language-project

  • 1
    @Fabrice-SonarTeam, can we do the same with maven? And if yes, do you have any examples? Thanks! p.s. that example on the git hub doesn't actually help, because we have different languages in one source folder. – mr.nothing Mar 14 '13 at 10:36
  • 1
    @mr.nothing You can probably check Neeraj's answer below as well – rajesh Mar 18 '13 at 14:15
  • @Fabrice-SonarTeam We have a solutions containing projects containing a mix of Javascript, C# and Xsd files. Looking at the .NET example: https://github.com/SonarSource/sonar-examples/tree/master/projects/languages/multi-language/multi-language-dotnet I don't see how you descripbe to Sonar which languages to analyse? It just seems to has 'cs' in the sonar-project.properties file. – RoboJ1M May 09 '13 at 16:46
  • @Fabrice-SonarTeam I think I must be missing something, why did you add to your answer that Sonar 3.3 and runner 2.0 can analyse multi-language projects? – RoboJ1M May 13 '13 at 08:22
  • Does it work for a project with both Groovy (grvy) and Java source/test code or mixed? I don't think it's working (sonar.language=grvy,java) – AKS Jan 27 '15 at 00:27
  • @Fabrice-SonarQubeTeam I tried it and got this. Can you please comment on that, thanks Fabrice. http://stackoverflow.com/questions/28154607/groovy-project-sonar-publish-project-and-unit-integration-test-code-covera – AKS Jan 27 '15 at 17:30
  • We are using v5.5 but it still doesn't pick the js files located in 'resources' folder. I looked at the example, there is no special configuration.. have I missed anything? – xbmono Sep 20 '16 at 05:10
  • 1
    @Fabrice-SonarSourceTeam the link https://github.com/SonarSource/sonar-examples/tree/master/projects/languages/multi-language/multi-language-dotnet has broken. I am trying to configure C# and JavaScript, but it works only for C# and overrides C# test counts when I set sonar.tests='js-tests-dir'. I cant see both counts in dashboard – Murali Murugesan Aug 31 '18 at 08:57
2

If you are using Sonar version 3.4. Then I have written a new maven plugin to help you with multiple language code analysis.

It is still beta

https://code.google.com/p/sonar-multilang-maven-plugin/wiki/UserGuide

If you have any issues with this tool then do let me know on that project website.

0

Until https://jira.sonarsource.com/browse/SONAR-926 is implemented you can use the combination of sonar.branch and sonar.language properties to analyze separately the project languages and have two different projects in your dashboard.

Onilton Maciel
  • 3,559
  • 1
  • 25
  • 29
ppapapetrou
  • 1,653
  • 9
  • 13
  • 2
    Can you please elaborate on the use of sonar.branch? My project is a mix of java and groovy mixed together. I mean there is no separation of src folders – rajesh Nov 30 '12 at 07:25