我们有一个用apache-maven 3.0.5构建的多模块项目。
以下是设置:
以下是我在运行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"在Sonar分析之前。
答案 0 :(得分:1)
我成功解决了这个问题。我发现Sonar Jenkins插件实际上并没有自己运行命令“mvn clean install”。相反,它只运行“mvn sonar:sonar”以及任何其他参数。
我在Sonar的构建后步骤之前执行了“mvn clean install”。这有助于解决我的问题。