Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
441 views
in Technique[技术] by (71.8m points)

sonarqube - Setup sonar-runner for multiple java projects

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 file for each project. But it is not clear to me where exactly I have to put these sonar-project.properties files.

I tried to add multiple .properties files in the $SONAR_RUNNER_HOME/conf folder but the runner does not seem to pick them up. It only sees the sonar-project.properties file.

Any suggestions on how to run sonar-runner for multiple projects?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...