首页 文章

SonarQube - Maven的依赖性问题

提问于
浏览
1

我们有一个用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目录损坏,在Sonar分析之前运行“mvn clean package”而不是“mvn clean install” .

1 回答

  • 1

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

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

相关问题