简体   繁体   English

Maven Sonar如何排除存储在本地存储库中的依赖罐

[英]Maven Sonar How to exclude dependancy jar which are stored in local repository

I am trying to run sonar analysis on my maven project , I have set repo in my d:\\abc folder . 我试图在我的Maven项目上运行声纳分析,我在d:\\abc文件夹中设置了repo。 I am trying to run mvn sonar:sonar , however it is trying to check sources for dependency jar which is not there and due to that build is failing . 我正在尝试运行mvn sonar:sonar ,但是它正在尝试检查源代码中是否存在依赖项jar,并且由于该构建失败。 I tried sonar.exclusions property in my setting.xml but that didn't help . 我在我的setting.xml尝试了sonar.exclusions属性,但这没有帮助。 I could not find anything on the internet that how can we ask sonar to ignore multiple jar and just focus on source . 我在互联网上找不到任何可以让声纳忽略多个罐子而只关注声源的信息。

Following is the error message : 以下是错误消息:

[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.6:sonar (default-cli) on project abc: No files nor directories matching 'D:\\abcrepo\\com\\abc\\tyr\\framework\\security\\abclogin\\2.7.9-SNAPSHOT\\abclogin-2.7.9-SNAPSHOT.jar' in directory C:\\abc\\Custom\\Source\\Build\\xyz\\MavenBuild\\abc_ear -> [Help 1] [错误]无法在项目abc上执行目标org.codehaus.mojo:sonar-maven-plugin:2.6:sonar(default-cli):没有文件或目录与'D:\\ abcrepo \\ com \\ abc \\ tyr \\ framework \\目录C:\\ abc \\ Custom \\ Source \\ Build \\ xyz \\ MavenBuild \\ abc_ear中的security \\ abclogin \\ 2.7.9-SNAPSHOT \\ abclogin-2.7.9-SNAPSHOT.jar'-> [帮助1]

Sonar version is 4.5.6. 声纳版本为4.5.6。 Any help is appreciated. 任何帮助表示赞赏。

You can use sonar.exclusions in your pom.xml to exclude your jar-directory : 您可以在pom.xml中使用sonar.exclusions排除jar目录:

<properties>
    <sonar.exclusions>first/path,second/path</sonar.exclusions>
<properties>

I tried following and it worked : 我尝试了下面的方法,它起作用了:

mvn sonar:sonar -pl !../abc_ear

using this I was able to skip specific module which was referring to the jar. 使用这个,我可以跳过引用jar的特定模块。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM