Is it possible to tell Sonar the project name from the command line?

喜你入骨 提交于 2019-12-07 11:10:41

问题


With each project created at my company, a new naming convention is used in Sonar. So some projects have their name as abbreviated, and some have their names as camel case, and some projects just have their names as words with spaces.

If we could pass sonar-runner a project-name parameter, then that would let us have these values set by the integrations team (2-3 people), instead of the head of each project (10+ possible people).

I feel like this may force us to create a Sonar rule for sonar properties, which is entirely too meta.

Is it possible to call something like sonar-runner --rootProject='my project' and have it? I already tried sonar-runner -DprojectName=$name.


回答1:


You're close, sonar.projectName is what you're looking for. Have a look at this documented list of Analysis Parameters.

Note that some SonarQube Scanners have specific behaviours, for example:

  • the scanner for Maven will in any case take values from the project definition itself (e.g. sonar.projectName is the project's <name> attribute)

  • the scanner for Gradle defaults to project.name

But when using the standard Scanner (sonar-runner) it's indeed a good idea to keep things under control by explicitly setting sonar.projectName.



来源:https://stackoverflow.com/questions/35648627/is-it-possible-to-tell-sonar-the-project-name-from-the-command-line

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!