• <small id='RkRiK'></small><noframes id='RkRiK'>

  • <tfoot id='RkRiK'></tfoot>

    1. <i id='RkRiK'><tr id='RkRiK'><dt id='RkRiK'><q id='RkRiK'><span id='RkRiK'><b id='RkRiK'><form id='RkRiK'><ins id='RkRiK'></ins><ul id='RkRiK'></ul><sub id='RkRiK'></sub></form><legend id='RkRiK'></legend><bdo id='RkRiK'><pre id='RkRiK'><center id='RkRiK'></center></pre></bdo></b><th id='RkRiK'></th></span></q></dt></tr></i><div id='RkRiK'><tfoot id='RkRiK'></tfoot><dl id='RkRiK'><fieldset id='RkRiK'></fieldset></dl></div>

      <legend id='RkRiK'><style id='RkRiK'><dir id='RkRiK'><q id='RkRiK'></q></dir></style></legend>

      • <bdo id='RkRiK'></bdo><ul id='RkRiK'></ul>

        sonar-maven-plugin:在多模块项目中扩展 sonar.sources

        时间:2024-05-09
            <tbody id='XDZAq'></tbody>

          <tfoot id='XDZAq'></tfoot>
          <i id='XDZAq'><tr id='XDZAq'><dt id='XDZAq'><q id='XDZAq'><span id='XDZAq'><b id='XDZAq'><form id='XDZAq'><ins id='XDZAq'></ins><ul id='XDZAq'></ul><sub id='XDZAq'></sub></form><legend id='XDZAq'></legend><bdo id='XDZAq'><pre id='XDZAq'><center id='XDZAq'></center></pre></bdo></b><th id='XDZAq'></th></span></q></dt></tr></i><div id='XDZAq'><tfoot id='XDZAq'></tfoot><dl id='XDZAq'><fieldset id='XDZAq'></fieldset></dl></div>

              <legend id='XDZAq'><style id='XDZAq'><dir id='XDZAq'><q id='XDZAq'></q></dir></style></legend>
                • <bdo id='XDZAq'></bdo><ul id='XDZAq'></ul>
                • <small id='XDZAq'></small><noframes id='XDZAq'>

                  本文介绍了sonar-maven-plugin:在多模块项目中扩展 sonar.sources的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我想扩展 sonar.sources,默认情况下是 pom.xml,src/main/java,由 src/main/resourcescode> 以检查位于那里的 XML 文件.

                  I want to extend sonar.sources, which by default is pom.xml,src/main/java, by src/main/resources in order to check XML files that are located there.

                  这个看似简单的任务结果却很困难,因为我有一个多模块 maven 项目(> 100 个模块,嵌套)其中很多没有 src/main/resources文件夹,其中大多数甚至不是 src 文件夹(例如,用于 Packaging=pom).如果我将 sonar.sources 设置为 pom.xml,src/main/java,src/main/resourcespom.xml,这会导致构建错误,src/main:

                  This seemingly simple task turned out to be difficult since I have a multi-module maven project (> 100 modules, nested) with a lot of them don't have a src/main/resources folder and most of them not even a src folder (e.g. for packaging=pom). This leads to a build error if I set sonar.sources to pom.xml,src/main/java,src/main/resources or pom.xml,src/main:

                  [ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.5:sonar (default-cli) on project xyz-parent: The directory 'C:...submodulesrcmain
                  esources' does not exist for Maven module ... Please check the property sonar.sources -> [Help 1]
                  

                  sonar-maven-plugin 本身使用 ${project.build.sourceDirectory} 在每个模块中正确执行此操作.

                  The sonar-maven-plugin itself uses ${project.build.sourceDirectory} to do it right in every module.

                  我尝试使用正则表达式通过切断 /java(或 java 在 Windows 上)通过

                  I tried to use regular expressions to set sonar.sources to src/main by cutting off /java (or java on Windows) via

                  <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>build-helper-maven-plugin</artifactId>
                    <version>1.7</version>
                    <executions>
                      <execution>
                        <id>regex-property</id>
                        <goals>
                          <goal>regex-property</goal>
                        </goals>
                        <configuration>
                          <name>sonar.sources</name>
                          <value>${project.build.sourceDirectory}</value>
                          <regex>[/\]+java$</regex>
                          <replacement></replacement>
                          <failIfNoMatch>false</failIfNoMatch>
                        </configuration>
                      </execution>
                    </executions>
                  </plugin>
                  

                  但这没有任何作用,我不知道我应该将它绑定到哪个生命周期阶段以使其执行.

                  But this does nothing and I have no idea to which lifecycle phase I should bind it to have it executed.

                  或者有没有办法避免由于 sonar.sources 中缺少目录而导致的错误?根据 当前 sonar-maven 源 缺少的目录仅在 POM 具有 pom 包装但不适用于 earjar 时被忽略没有资源的模块.

                  Or is there a way to avoid the error due to missing directory in sonar.sources? According to current sonar-maven source missing directories are only ignored if the POM has pom packaging but not for ear or jar modules without resources.

                  或者我应该确保 src/main 在声纳启动之前存在?我可以使用什么钩子?

                  Or should I ensure src/main exists before sonar start? What hook may I use for that?

                  推荐答案

                  你能做到的事情之一:

                  • 在您的根 POM 中,定义以下属性:
                    • sonar.sources.
                    • sonar.inclusionssrc/main/**
                    • => 这将包括 SQ 在 src/main 文件夹中的模块中找到的所有已知文件(如果存在)
                    • In your root POM, define the following properties:
                      • sonar.sources to be .
                      • sonar.inclusions to be src/main/**
                      • => this will include all the known files that SQ finds in your modules in the src/main folder if it exists

                      这篇关于sonar-maven-plugin:在多模块项目中扩展 sonar.sources的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:声纳违规:安全性 - 使用 byte[] 时直接存储数组 下一篇:Sonar 想要关闭 Stream

                  相关文章

                • <small id='WSWF6'></small><noframes id='WSWF6'>

                    <tfoot id='WSWF6'></tfoot><legend id='WSWF6'><style id='WSWF6'><dir id='WSWF6'><q id='WSWF6'></q></dir></style></legend>
                    1. <i id='WSWF6'><tr id='WSWF6'><dt id='WSWF6'><q id='WSWF6'><span id='WSWF6'><b id='WSWF6'><form id='WSWF6'><ins id='WSWF6'></ins><ul id='WSWF6'></ul><sub id='WSWF6'></sub></form><legend id='WSWF6'></legend><bdo id='WSWF6'><pre id='WSWF6'><center id='WSWF6'></center></pre></bdo></b><th id='WSWF6'></th></span></q></dt></tr></i><div id='WSWF6'><tfoot id='WSWF6'></tfoot><dl id='WSWF6'><fieldset id='WSWF6'></fieldset></dl></div>
                        <bdo id='WSWF6'></bdo><ul id='WSWF6'></ul>