一个伪linux粉丝的blog

  1. 首页
  2. unix/linux
  3. 正文

Sonar Not inside a Git work tree: /workspace

1月 27, 2021 500点热度 0人点赞 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

里面有

the correct configuration is more like:
sonar.projectBaseDir=$WORKSPACE/my-subdir
sonar.sources=.
sonar.scm.provider=git

然后参考修改

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段介绍

Supported SCM engines

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.

Disabling SCM support

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 的前半段介绍,也就想不起来这个参数和前面有关联。

相关文章:

  1. Google Chrome 1.0.154.136 Final
  2. Docker_Conflunce
  3. Can't execute jar- file: “no main manifest attribute”
  4. SourceForge宣布2008年度社区选择奖
标签: Sonar
最后更新:1月 27, 2021

wanjie

这个人很懒,什么都没留下

点赞
< 上一篇
下一篇 >

文章评论

取消回复

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据。

归档
分类
  • network / 322篇
  • Uncategorized / 114篇
  • unix/linux / 110篇
  • 业界资讯 / 38篇
  • 公司杂事 / 11篇
  • 数码影像 / 12篇
  • 美剧 / 3篇
  • 美图共赏 / 20篇
  • 英语学习 / 3篇
标签聚合
dreamhost空间 wget jira docker 网站运营 unveiled today k8s Nginx Android 刷机 邮件归档 dreamhost VPS google-chrome Google Voice Ubuntu iMac kernel debian ldap 虚拟主机 d90 Google 天翼live Linux gitlab 黑莓8700 职责 泰国 nexus

COPYRIGHT © 2008-2022 wanjie.info. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang