< sonar.exclusions>在pom.xml中(Maven多模块项目)在本地工作但不在公司服务器上工作 [英] <sonar.exclusions> in pom.xml (Maven multi-module project) works locally but not on company server
问题描述
我在pom.xml中使用< sonar.exclusions>
来排除单元测试代码覆盖率的某些包。我在当地设置了Sonar,排除项反映在报告上。但是,公司服务器上没有相同的例外情况。
I'm using <sonar.exclusions>
in pom.xml to exclude certain packages for unit test code coverage. I have set up Sonar locally and the exclusions reflect on the report. But then, the same exclusions are not honored on the company server.
我正在使用< sonar.skippedModules>
按预期工作,并在两种环境下完全跳过所需的模块。
I am using <sonar.skippedModules>
which works as intended and skips the required modules perfectly fine on both environments.
本地声纳版本是版本4.3.1公司的声纳版本是版本4.1.2
Local Sonar version is Version 4.3.1 Company's Sonar version is Version 4.1.2
我在其中一个模块中编写< sonar.skippedModules>
的示例:
An example of how I have written <sonar.skippedModules>
in one of the modules:
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.mainClass>.....</project.mainClass>
<sonar.exclusions>
/src/main/java/../../../../../Package1/*,
/src/main/java/../../../../../Package2/*,
/src/main/java/../../../../../JavaClass1.java
</sonar.exclusions>
<sonar.language>java</sonar.language>
</properties>
你能帮我理解为什么 < sonar.exclusions>
仅限本地但不包括当我构建作业(在Jenkins上设置)以在公司服务器上生成Sonar报告时?版本的区别是否重要?
Can you please help me understand why <sonar.exclusions>
is honored only locally but not when I build the job (set up on Jenkins) to generate the Sonar report on the company server? Does the difference in the version matter?
在逗号分隔包名后是否缺少换行符会产生影响吗?
Would absence of new-line character following the comma to separate the package names make a difference?
推荐答案
试试这个,我有同样的问题,它对我有用
Try this, I had same issue and it worked for me
不要以 / src / main / java /
取而代之的是 com / companyname / projectname /
我个人更喜欢 ** com / companyname / projectname /../**
这篇关于< sonar.exclusions>在pom.xml中(Maven多模块项目)在本地工作但不在公司服务器上工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!