環境:maven 3.6.1,sonarQube8.4.1
1. Missing blame information for the following files
我們可以通過命令或者直接在eclipse中跑sonar報告,來幫助提高代碼質量和檢查覆寫率等。
我們在獲取sonar report的時候,在log和sonarQube頁面的警告中會有"Missing blame information for the following files"的警告資訊,這個是因為我們有改修或者追加的source沒有存盤到源代碼管理中,這個和sonar-scm-git-plugin有關。
如果我們想解除這個警告,其實很簡單(自己調查的時候走了很多彎路
),我們只需要把本地改修的代碼commit即可。如果改修的代碼不需要存盤到源代碼管理中,我們只需要打開sonarQube,然后在configuration中找到SCM,然后把“Disable the SCM Sensor”有效化即可(不推薦,一般我們的代碼都是通過git管理的,不需要做這個處理)。

2. Bytecode of dependencies was not provided for analysis of source files, you might end up with less precise results. Bytecode can be provided using sonar.java.libraries property.
如果我們看到這個警告,我們就需要配置sonar.java.libraries,不同環境的配置方式不同,我是在maven的setting.xml配置sonar。
一般配置需要指定:
sonar.jdbc.url,
sonar.jdbc.username,
sonar.jdbc.password,
sonar.host.url,
sonar.java.binaries,
解決這個問題,我追加配置了上面說的sonar.java.libraries,在這個標簽中配置commons-lang3-3.9.jar包即可。
3. sonar.jacoco.reportPaths換成sonar.coverage.jacoco.xmlReportPaths
sonarQube的最新版本中,已經不支持分析非xml的report,所以我們在升級sonarQube后,記得洗掉之前配置的sonar.jacoco.reportPaths,換成sonar.coverage.jacoco.xmlReportPaths去指定。
一般sonar.coverage.jacoco.xmlReportPaths有默認路徑是**/target/site/jacoco/jacoco.xml,如果不需要指定新路徑,我們就可以不設定這個值,使用默認的,如果我們需要重新指定新路徑,可以通過sonar.coverage.jacoco.xmlReportPaths重新設定路徑。
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/27823.html
標籤:Java相關
上一篇:BigDecimal 用法
下一篇:Hello World !
