克隆到子目录时的 SonarQube Jenkins/git 集成 [英] SonarQube Jenkins/git integration when cloning to a subdirectory

查看:17
本文介绍了克隆到子目录时的 SonarQube Jenkins/git 集成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有 Jenkins 的 git 插件将我的存储库克隆到 WORKSPACE 的子目录.因此,我设置了

I have Jenkins' git plug-in clone my repository to a subdirectory of WORKSPACE. Accordingly, I set

sonar.sources=my/subdir

但是,上述设置似乎并未通知 SCM 检测;和设置

SCM detection doesn't seem to be informed by the above setting, however; and setting

sonar.scm.provider=git

…产量:

ERROR: Not inside a Git work tree: /path/to/my/workspace

如何通知 SonarQube 的 git 插件我的源位置?(为什么使用 sonar.sources 不够聪明?)

How do I inform SonarQube's git plug-in of the location of my sources? (And why isn't it clever enough to use sonar.sources?)

推荐答案

如果您的代码在子目录中,则必须设置以下属性

You have to set the following property if your code is in a subdirectory

sonar.projectBaseDir

例如,如果您的代码在 mycodedir 中,那么您会这样做

For example if your code was in mycodedir then you would do

-D"sonar.projectBaseDir=${WORKSPACE}/mycodedir"

当您这样做时,您可以将源和测试参数更改为上述目录的引用,例如

When you do this you can then change the sources and tests parameters to references of the above directory e.g.

如果您在 mycodedir/mysources 中有源代码,并且在 mycodedir/tests 中有测试

If you have source code in mycodedir/mysources and tests in mycodedir/tests

sonar.sources=./mysources
sonar.tests=./tests

这篇关于克隆到子目录时的 SonarQube Jenkins/git 集成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆