开发者

How to set up a pom.xml to process certain directories with Maven for Sonar?

开发者 https://www.devze.com 2023-03-21 07:42 出处:网络
I have a directory structure something like this: base subdir1 subdir2 subdir3 subsubdir1 subsubdir2 subdir4

I have a directory structure something like this:

  • base
    • subdir1
    • subdir2
    • subdir3
      • subsubdir1
      • subsubdir2
    • subdir4
    • unittests

How do I set up my pom.xml so that it only processes the folders in bold? If possible, I want them to all be processed in one mvn sonar:sonar call, and to show up as separate projects in Sonar. I tried looking at the documentation for the Project Object Model, but I found it to be overwhelming, and couldn't figure out how to set it up as I described. This is what my pom.xml, located in base, currently looks like:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <groupId>com.foo.bar.baz</groupId>
        <artifactId>subsubdir2</artifactId>
        <name>MyProject</name>
        <version>1.0</version>

        <build>
                <sourceDirecto开发者_StackOverflow中文版ry>subdir3/subsubdir2</sourceDirectory>
                <testSourceDirectory>unittests</testSourceDirectory>
        </build>

        <properties>
                <sonar.language>php</sonar.language>
                <sonar.phase>generate-sources</sonar.phase>
        </properties>
</project>


You can build the top level pom and use the sonar.skippedModules or sonar.includedModules property to set up the list of modules to build. This won't show each module as a separate project at the top level of sonar, but if you go into the project and select "modules", then you'll see each one listed, as if it were a separate project.

0

精彩评论

暂无评论...
验证码 换一张
取 消