简体   繁体   中英

How can i add a module to a maven multi-project for sonar?

i have a Maven multi project with several modules in the pom.xml. But for the sonar-Scan i want to use other modules (includes and excludes)!

The property-file (sonar-project.properties) is not used in Maven-Projects, so the properties sonar.modules and xxx.sonar.projectBaseDir are not working.

How can i configure it with Maven?

You can use Maven profiles to include only specific modules: http://maven.apache.org/guides/introduction/introduction-to-profiles.html

Example:

<profiles>
    <profile>
        <id>all</id>
        <modules>
            <module>module-A</module>
            <module>module-B</module>
            <module>module-C</module>
        </modules>
    </profile>
    <profile>
        <id>sonar</id>
        <modules>
            <module>module-A</module>
            <module>module-C</module>
            <module>module-D</module>
        </modules>
    </profile>
</profiles>

Execute mvn -Psonar clean package sonar:sonar

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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