【问题标题】:SonarQube - Dependency Issues with MavenSonarQube - Maven 的依赖问题
【发布时间】:2014-07-23 16:36:13
【问题描述】:

我们有一个使用 apache-maven 3.0.5 构建的多模块项目。

这里是设置:

  • 通过 Jenkins 运行 Sonar 插件。
  • SonarQube 服务器和 MySQL 位于另一台计算机上。
  • 在 Jenkins 上使用 Sonar 插件运行分析,然后将结果推送到 SonarQube 服务器。

这是我在运行 Sonar 作业时收到的警告。

**这些警告似乎对服务器结果没有影响。 SonarQube 服务器显示违反规则,并且那里似乎没有缺少任何类。

分析前:

[WARNING] The following dependencies could not be resolved at this point of the build but seem to be part of the reactor:
15:04:52 [WARNING] o com.company.product.plugins:com.company.product.external.libraries:jar:1.0.0-SNAPSHOT (provided)
15:04:52 [WARNING] Try running the build up to the lifecycle phase "package"
15:04:52 [WARNING] The following dependencies could not be resolved at this point of the build but seem to be part of the reactor:
15:04:52 [WARNING] o com.company.product.plugins:com.company.product.capturetool.core:jar:1.0.0-SNAPSHOT (provided)

分析过程中:

Class 'com/company/product/core/tools/ocraction/MyClass' is not accessible through the ClassLoader.
    [WARN] [15:05:25.731] Class 'com/company/product/core/tools/ocraction/MyClass' is not accessible through the ClassLoader.

分析后:

[INFO] com.company.product.core.feature ................ SKIPPED
[INFO] com.company.product.common.feature ... SKIPPED
[INFO] My Product ............................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS

我很困惑为什么会这样。我在网上搜遍了没有答案。在声纳分析之前,我收到了诸如 .m2 目录损坏等响应,以运行“mvn clean package”而不是“mvn clean install”。

【问题讨论】:

    标签: maven jenkins sonarqube


    【解决方案1】:

    我设法解决了这个问题。我发现 Sonar Jenkins 插件本身实际上并没有运行命令“mvn clean install”。相反,它只运行“mvn sonar:sonar”以及任何其他参数。

    我在 Sonar 的后期构建步骤之前执行了“mvn clean install”。这有助于解决我的问题。

    【讨论】:

    • FWIW:执行mvn clean verify 应该足够了。
    猜你喜欢
    • 2020-10-21
    • 1970-01-01
    • 2021-12-06
    • 2011-10-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-11-26
    • 2014-01-12
    相关资源
    最近更新 更多