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

查看:101
本文介绍了克隆到子目录时,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天全站免登陆