It is possible to disable SCM support in the "General Settings > SCM" administration page or setting property sonar.scm.disabled=true during project analysis.
没有5.0 的前半段介绍,也就想不起来这个参数和前面有关联。
今天客户有一个故障,日志里面有类似Not inside a Git work tree: /workspace 报错,结果排查了几个小时,几乎崩溃,记录一下。
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.6.0.1398:sonar (default-cli) on project wire-rope-tension2-service: Not inside a Git work tree: /workspace -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.6.0.1398:sonar (default-cli) on project wire-rope-tension2-service: Not inside a Git work tree: /workspace
....
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
Caused by: org.sonar.api.utils.MessageException: Not inside a Git work tree: /workspace
[ERROR]
[ERROR]
根据特征 ,找到 这个https://groups.google.com/g/sonarqube/c/GyTqFzFKGgM
里面有
然后参考修改
mvn clean test package sonar:sonar \
-Dsonar.projectKey=$SONAR_PROJECT_KEY \
-Dsonar.host.url=$SONAR_HOST_URL \
-Dsonar.login=$SONAR_LOGIN \
-Dsonar.sources=$SONAR_SOURCES \
-Dsonar.java.binaries=$SONAR_JAVA_BINARIES \
-Dsonar.java.covergaePlugin=jacoco \
-Duser.timezone=Asia/Shanghai \
-Dsonar.jacoco.reportPaths=target/jacoco.exec -X
增加2行-Dsonar.scm.provider=git 和 -Dsonar.projectBaseDir=/workspace,结果报错依然相同。
后面尝试修改镜像,修改maven的原始settings.xml 文件,陷入更多的错误。
后来同事找到这个 https://docs.sonarqube.org/display/SONARQUBE50/SCM+support
里面 有2段介绍
Git and Subversion are natively supported in SonarQube. Auto-detection will works if the root directory of your project contains .git or .svn folders. Otherwise you can force the provider using -Dsonar.scm.provider=git
or -Dsonar.scm.provider=svn
.
It is possible to disable SCM support in the "General Settings > SCM" administration page or setting property sonar.scm.disabled=true
during project analysis.
于是增加一个字段 -Dsonar.scm.disabled=true
mvn clean test package sonar:sonar \
-Dsonar.projectKey=$SONAR_PROJECT_KEY \
-Dsonar.host.url=$SONAR_HOST_URL \
-Dsonar.login=$SONAR_LOGIN \
-Dsonar.sources=$SONAR_SOURCES \
-Dsonar.java.binaries=$SONAR_JAVA_BINARIES \
-Dsonar.java.covergaePlugin=jacoco \
-Duser.timezone=Asia/Shanghai \
-Dsonar.scm.disabled=true \
-Dsonar.jacoco.reportPaths=target/jacoco.exec -X
sonar阶段顺利执行完成
其实自己找到过7的介绍
https://docs.sonarqube.org/7.0/SCMsupport.html
里面 有1段介绍
It is possible to disable SCM support in the "General Settings > SCM" administration page or setting property sonar.scm.disabled=true during project analysis.
没有5.0 的前半段介绍,也就想不起来这个参数和前面有关联。
wanjie
这个人很懒,什么都没留下
文章评论