How to have code coverage in Jenkins with Jacoco and multiple modules?

前端 未结 1 1989
礼貌的吻别
礼貌的吻别 2021-01-18 22:05

My code structure is as follows :

events
messages
other-code
functional-tests

In the build script for jacoco,

相关标签:
1条回答
  • 2021-01-18 23:01

    To include multiple class directories by changing the Jenkins JaCoCo plugin configuration, you would need to modify the 'Path to class directories' field.

    For instance, if you want to include any classes under the directories 'events' and 'other-code', you would add the following to the 'Path to class directories' section:

    **/events,**/other-code
    

    Keep in mind that if you want to add multiple directories, you have to separate each one by a comma and there can be no spaces (due to a bug with the plugin). Note: this comma bug is true of all text fields in this plugin configuration.

    Here is my working JaCoCo plugin configuration:

    EDIT: As mentioned in comments, one solution to this problem is to utilize whatever build tool you are dealing with (Ant, Maven, Gradle) to drop the target (ie: jar, war, etc.) into a common directory and just point the jacoco plugin there.

    0 讨论(0)
提交回复
热议问题