【问题标题】:Sonar SonarQube - SonarWay Findbugs - Missing classes message during sonarRunner taskSonar SonarQube - SonarWay Findbugs - sonarRunner 任务期间缺少课程消息
【发布时间】:2013-09-09 12:53:12
【问题描述】:

环境:Java/Linux/Gradle 1.6/Jenkins 最新

gradle clean build jacocoTestReport sonarRunner - 工作正常。

在 sonarRunner 任务期间,当 sonarRunner 尝试将数据发布到 Sonar 自己的数据库 (org.h2.jdbc..) 时,我看到以下缺少的类/行

我在输出中看到以下几行。我该怎么做才能使这些丢失的项目最终不会在 sonarRunner 任务/步骤中显示出来。

11:15:47 11:15:47.076 INFO  - Findbugs output report: /production/jenkinsAKS/jobs/CAPersonSvc/workspace/build/sonar/findbugs-result.xml
11:15:55 The following classes needed for analysis were missing:
11:15:55   org.springframework.context.ApplicationContext
11:15:55   org.springframework.context.support.ClassPathXmlApplicationContext
11:15:55   javax.crypto.SecretKey
11:15:55   javax.crypto.spec.PBEKeySpec
11:15:55   javax.crypto.SecretKeyFactory
11:15:55   javax.crypto.spec.PBEParameterSpec
11:15:55   javax.crypto.Cipher
11:15:55   javax.crypto.KeyGenerator
11:15:55   javax.crypto.spec.IvParameterSpec
11:15:55   javax.crypto.spec.SecretKeySpec
11:15:55 11:15:55.245 INFO  - Execute Findbugs 2.0.1 done: 10991 ms
11:15:55 11:15:55.247 INFO  - Sensor FindbugsSensor done: 10994 ms

谢谢

【问题讨论】:

  • 您是否在构建文件中将 javax crypto 和 spring 定义为依赖项?
  • 否,因为构建工作正常。这是在 sonarRunner 任务期间出现的
  • 这些类是你自己的代码直接使用的吗?
  • 回答Fabrice,不。在编译/测试/战争包操作期间,我们没有使用任何这些 jar。顺便说一句,JarFinder.com 没有向我展示 javax.crypto.* 的 jar,除了 javax.crypto.Cipher 要回答皮特,我不这么认为。

标签: gradle sonarqube analysis sonar-runner


【解决方案1】:

缺少的类是第三方 jar 的一部分。

请找到jar文件名from here,然后在本地机器中搜索jar文件的位置。

使用 jar 文件位置更改 build.gradle

sonarRunner {
    sonarProperties {
        properties["sonar.libraries"] += "../Lib/for_spring.jar,../Lib/for_javax.jar"
    }
}

你可以通过this for reference:第36.5章

如果您错过任何运行时依赖项添加,您将收到这样的警告

19:57:21.394 WARN  - Class 'org/apache/commons/chain/Command' is not accessible through the ClassLoader.

正如您所说,您没有收到此警告,因此可能这些不是运行时依赖项。我不确定这些是什么依赖项,但你可以试试这个。

【讨论】:

  • Gradle 使用构建脚本中声明的 compileruntime 依赖项(及其传递依赖项)自动配置 sonar.libraries
  • 我会尝试你的提示 Panther,但也同意 Pete。
  • @ArunSangal : 我已经更新了答案,你可以试试这个。
猜你喜欢
  • 2017-07-30
  • 2014-11-23
  • 2015-02-20
  • 1970-01-01
  • 2014-08-03
  • 1970-01-01
  • 2015-09-27
  • 2018-03-18
  • 1970-01-01
相关资源
最近更新 更多