Setup sonar-runner for multiple java projects

前端 未结 3 1203
生来不讨喜
生来不讨喜 2020-12-03 10:45

I am trying to run sonar-runner to analyze multiple Java projects in one go. According to the documentation it is just a matter of creating a sonar-project.properties<

3条回答
  •  情深已故
    2020-12-03 11:42

    Actually it is quite simple to let the sonar runner analyze multiple projects as long as they are in the same file system. Just put a properties file in a directory that is not to far away from the projects. Then declare each of your projects in this properties file.

    Lets assume you have 4 projects in dev/general/BasicStuff, dev/service/CoolStuff, dev/utility/UtilStuff and dev/display/FrameWorkStuff.

    As described in hereWay #2 you create a file in dev which contains the line

    sonar.modules=BasicStuff,CoolStuff,UtilStuff,FrameWorkStuff
    

    And for each of the "modules" a line like

    BasicStuff.sonar.projectBaseDir=general/BasicStuff
    CoolStuff.sonar.projectBaseDir=service/CoolStuff
    

    Inside the project directories you in turn create a file which contains the other needed information, e.g.

    sonar.projectName=BasicStuff
    sonar.sources=src
    

    If you start sonar runner with the top level properties as target you get a comprehensive result which shows metrics across the projects as well as allowing you to drill into each of them.

    Hope this was what you were looking for.

提交回复
热议问题