【问题标题】:SonarQube: Getting error Reports path not found or is not a directory and Classes not found during the analysisSonarQube:获取错误报告路径未找到或不是目录并且分析期间未找到类
【发布时间】:2020-08-31 03:49:19
【问题描述】:

无法成功进行声纳分析,也没有通过 URL 获得 ANALYSIS SUCCESSFUL 以在 SonarQube 上浏览

错误日志:-

16:19:31  > Task :sonarqube
16:19:31  Reports path not found or is not a directory: /home/xxxxxxxxxx/model/target/surefire-reports
16:19:31  Reports path not found or is not a directory: /home/xxxxxxxxx/store/target/surefire-reports
16:19:42  Classes not found during the analysis : [io.prometheus.client.CollectorRegistry, org.openid4java.consumer.ConsumerException, org.openid4java.consumer.ConsumerManager, org.springframework.security.oauth2.client.OAuth2AuthorizedClientService, org.springframework.security.oauth2.client.registration.ClientRegistration, org.springframework.security.oauth2.client.registration.ClientRegistrationRepository, org.springframework.security.oauth2.client.web.OAuth2AuthorizedClientRepository, org.springframework.security.oauth2.client.web.OAuth2LoginAuthenticationFilter, org.springframework.security.openid.AxFetchListFactory, org.springframework.security.openid.OpenIDAuthenticationFilter, org.springframework.security.openid.OpenIDAuthenticationToken, org.springframework.security.openid.OpenIDConsumer]
16:19:44  
16:19:44  Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
16:19:44  Use '--warning-mode all' to show the individual deprecation warnings.
16:19:44  See https://docs.gradle.org/5.3.1/userguide/command_line_interface.html#sec:command_line_warnings
16:19:44  
16:19:44  BUILD SUCCESSFUL in 2m 24s
16:19:44  18 actionable tasks: 15 executed, 3 up-to-date

我正在使用命令 ./gradlew sonarqube

以上使用 java-8-openjdk-amd64

构建

并使用 java-11-openjdk

运行声纳分析

我尝试将其更改为 Java 8,但得到了这个:-

19:42:10  > Task :sonarqube
19:42:10  SonarScanner will require Java 11 to run starting in SonarQube 8.x

gradle.properties 文件:-

javaxValidationVersion=2.0.1.Final
systemProp.sonar.host.url=xxxxxxxxxxxxx
swaggerAnnotationsVersion=1.5.22
lombokVersion=1.18.6
jooqVersion=3.11.11
springBootVersion=2.2.0.M4
logstashEncoderVersion=5.3
pgVersion=10
pgDriverVersion=42.2.5
flywayVersion=5.2.4
flywaySpringTestVersion=5.2.1
testContainersVersion=1.11.1
modelMapperVersion=2.3.2
seleniumJavaVersion=3.141.59
commonsLang3Version=3.9
commonsTextVersion=1.6
jschVersion=0.1.55

# Spring boot version overrides
jooq.version=3.11.11

build.gradle 文件:-

plugins {
    id("net.nemerosa.versioning") version "2.8.2"
    id "org.sonarqube" version "2.7"    
}

allprojects {
    group = "xxxxxx"
    version = versioning.info.full

    repositories {
        jcenter()
        maven { url 'https://repo.spring.io/milestone' }
        maven { url 'xxxxxxxxx' }

    }
}

如果您需要更多信息,请告诉我。

【问题讨论】:

    标签: java jenkins gradle sonarqube gradlew


    【解决方案1】:

    在你的build.gradle

    • 您没有列出单个依赖项。你 需要列出所有的项目依赖,例如Prometheusopenid4java
    • 您还希望配置可以从中找到和下载这些工件的各种存储库
    • 您应该配置surefire 插件。看到这个example

    你得到的错误太多了。在尝试其他任何事情之前,一次解决一个问题。

    【讨论】:

    • 谢谢,对不起,我是新手,有几个问题:- 1. 我怎样才能找到所有的项目依赖关系? 2.尝试使用surefire插件但使用gradle构建项目而不是maven,如何做到这一点?
    • 如果您的代码使用任何非JDK库,您需要将其指定为您的项目依赖项。如果您使用的是第三方库,您显然也应该知道在哪里可以找到它。不可能是您正在使用图书馆,但您不知道在哪里可以找到它。但是,如果您仍然不知道在哪里可以找到该库,您可以在 Maven Central 等流行的存储库中找到它。当然,您还需要在 build.gradle 中配置一个 repo。我建议你先练习使用Gradle
    • @Alin,您能解决问题的任何部分吗?如果你是,请不要忘记接受答案。
    猜你喜欢
    • 2015-11-28
    • 1970-01-01
    • 2018-07-22
    • 1970-01-01
    • 1970-01-01
    • 2014-04-10
    • 2017-09-18
    • 2015-09-18
    • 2013-04-02
    相关资源
    最近更新 更多