SonarQube排除Maven模块 [英] SonarQube exclude Maven module
问题描述
我正在使用Maven/Jenkins CI运行声纳5.1.2.
I'm running sonar-5.1.2 with Maven / Jenkins CI.
在仔细搜索并浏览了类似的问题(大多数问题可以追溯到2010-2012年)之后,仍不清楚如何从多模块Maven项目中排除特定的Maven模块.
After googling and looking through similar questions (most of them are dated back to 2010-2012), it is still not clear how to exclude a particular Maven module from multi-module Maven project.
模块排除属性已被弃用,并且不应再使用.
Module Exclusions property is deprecated since version 4.3 and should not be used anymore.
我们在不同的模块中复制了软件包:
We have duplicating packages in different modules:
root pom.xml
|-module1
|-my.package.com
|-module2
|-my.package.com
是否可以仅从module2/my.package.com
中排除文件,但包括module1/my.package.com
?
Is it possible to exclude only files from module2/my.package.com
but include module1/my.package.com
?
SonarQube分析由 https://wiki.jenkins-ci.org触发/display/JENKINS/SonarQube + plugin 生成操作
SonarQube analysis is triggered by https://wiki.jenkins-ci.org/display/JENKINS/SonarQube+plugin post build action
推荐答案
有两个记录的选项,将模块从SonarQube分析中排除;引用:
There are two documented options to exclude a module from a SonarQube analysis; quoting:
您可以:
- 使用构建配置文件排除某些模块(例如集成测试)
- 使用高级反应堆选项(例如"-pl").例如mvn sonar:sonar -pl!module2
由于您使用的是Jenkins,也许更简单的解决方案是使用-pl
选项.这样,您将不会更改Maven项目中的任何配置,而只会更改Jenkins的配置.
Since you are using Jenkins, maybe the simpler solution is to use the -pl
option. This way, you won't change any configuration in your Maven project and you will only change Jenkins configuration.
这篇关于SonarQube排除Maven模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!