Jacoco Maven multi module project coverage

后端 未结 5 1823
余生分开走
余生分开走 2020-12-30 01:49

Seems like there are couple of questions, which are quite old and things changed from Java 8 support of Jacoco.

My Project contains following structure



        
5条回答
  •  一生所求
    2020-12-30 02:20

    One problem in multimodule projects is caused, if the aggregator pom is used as parent pom for the modules either, like it is the case in the above example:

    - parentAggregator pom
    ---sub module A pom.xml -> parentAggregator pom
    ---sub module B pom.xml -> parentAggregator pom
    ---sub module C pom.xml -> parentAggregator pom
    

    In this case, the build order is:

    - parentAggregator
    - sub module A
    - sub module B
    - sub module C
    

    which means, that the parent aggregator can not collect complete information. In my case a transfer of data into sonarQube by mvn sonar:sonar resulted in unexpected and uncomplete results.

    Changing the module structure to:

    - aggregator pom
    -- parent pom
    ---sub module A pom.xml -> parent pom
    ---sub module B pom.xml -> parent pom
    ---sub module C pom.xml -> parent pom
    

    will change the build order to:

    - parent
    - sub module A
    - sub module B
    - sub module C
    - aggregator
    

    In this case aggregator will be the last one and work with the results of the modules. In my case the results in SonarQube were like expected.

提交回复
热议问题