File tree Expand file tree Collapse file tree 1 file changed +68
-0
lines changed Expand file tree Collapse file tree 1 file changed +68
-0
lines changed Original file line number Diff line number Diff line change @@ -48,10 +48,78 @@ test:
48
48
49
49
View source and learn more about [Codecov Global Uploader][4]
50
50
51
+ # # Multi-module projects (exmple with Travis CI)
52
+ Update your parent (root) `build.gradle` :
53
+ ` ` ` groovy
54
+ allprojects {
55
+ apply plugin: 'java'
56
+ apply plugin: 'maven'
57
+ apply plugin: 'jacoco'
58
+
59
+ sourceCompatibility = 1.8
60
+ targetCompatibility = 1.8
61
+
62
+ repositories {
63
+ mavenLocal()
64
+ mavenCentral()
65
+ jcenter()
66
+
67
+ maven { url "http://repo1.maven.org/maven2/" }
68
+ }
69
+ }
70
+
71
+ subprojects {
72
+ dependencies {
73
+ ...
74
+ }
75
+
76
+ test.useTestNG()
77
+ }
78
+
79
+ task codeCoverageReport(type: JacocoReport) {
80
+ executionData fileTree(project.rootDir.absolutePath).include("**/build/jacoco/*.exec")
81
+
82
+ subprojects.each {
83
+ sourceSets it.sourceSets.main
84
+ }
85
+
86
+ reports {
87
+ xml.enabled true
88
+ xml.destination "${buildDir}/reports/jacoco/report.xml"
89
+ html.enabled false
90
+ csv.enabled false
91
+ }
92
+ }
93
+
94
+ codeCoverageReport.dependsOn {
95
+ subprojects*.test
96
+ }
97
+ ` ` `
98
+
99
+ Update your `.travis.yml` file :
100
+ ` ` ` yml
101
+ language: java
102
+ jdk:
103
+ - oraclejdk8
104
+ before_script:
105
+ - chmod +x gradlew
106
+ script:
107
+ - ./gradlew check
108
+ - ./gradlew codeCoverageReport
109
+ after_success:
110
+ - bash <(curl -s https://codecov.io/bash)
111
+ ` ` `
112
+
113
+ No need to have anything else report-related in child modules
114
+
115
+ [Credits for multi-module][8]
116
+
117
+
51
118
[1] : https://codecov.io/
52
119
[2] : https://twitter.com/codecov
53
120
54
121
[4] : https://github.com/codecov/codecov-python
55
122
[5] : http://gradle.org/
56
123
[6] : https://docs.gradle.org/current/userguide/jacoco_plugin.html
57
124
[7] : https://github.com/codecov/codecov-bash
125
+ [8] : https://csiebler.github.io/blog/2014/02/09/multi-project-code-coverage-using-gradle-and-jacoco/
You can’t perform that action at this time.
0 commit comments