Sonar扫描的NPE问题解决方案

Sonar扫描的NPE问题

report this on Sonar Community: Commons-lang StringUtils isNotBlank method still raise NPE

有人遇到了相同的问题,官方猜测是没有正确的配置sonar.java.libraries

SonarQube上的确提示——

Bytecode of dependencies was not provided for analysis of source files, you might end up with less precise results. Bytecode can be provided using sonar.java.libraries property.

手动验证,将commons-lang3-3.7.jar添加到sonar.java.libraries参数里,问题解决。


下一步需要处理的方式——

added the target “dependency:copy-dependencies” as part of the maven execution. This copied all the dependencies to the right location, then I set the property “-Dsonar.java.libraries=target/dependency” in our case.

将项目的依赖都复制到固定的目录,然后将这个目录传递给sonar.java.libraries参数。

dependency:copy-dependencies的官方用法。

理论上这样就可以解决这个问题,需要验证的是多模块的项目的依赖是否可以全部正确复制到正确的目录下。

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容