|
35 | 35 | <hamcrest.version>2.2</hamcrest.version> |
36 | 36 | <okhttp3.version>3.12.3</okhttp3.version> |
37 | 37 | <okio.version>2.4.1</okio.version> |
| 38 | + <jacoco.coverage.target>0.20</jacoco.coverage.target> |
| 39 | + <!-- For non-ci builds we'd like the build to still complete if jacoco metrics aren't met. --> |
| 40 | + <jacoco.haltOnFailure>false</jacoco.haltOnFailure> |
38 | 41 | </properties> |
39 | 42 |
|
40 | 43 | <build> |
|
46 | 49 | </excludes> |
47 | 50 | </testResource> |
48 | 51 | </testResources> |
| 52 | + <pluginManagement> |
| 53 | + <plugins> |
| 54 | + <!-- adds jacoco coverage --> |
| 55 | + <plugin> |
| 56 | + <groupId>org.jacoco</groupId> |
| 57 | + <artifactId>jacoco-maven-plugin</artifactId> |
| 58 | + <version>0.8.5</version> |
| 59 | + </plugin> |
| 60 | + </plugins> |
| 61 | + </pluginManagement> |
49 | 62 | <plugins> |
50 | 63 | <plugin> |
51 | 64 | <artifactId>maven-compiler-plugin</artifactId> |
|
271 | 284 | <url>https://repo.jenkins-ci.org/public/</url> |
272 | 285 | </pluginRepository> |
273 | 286 | </pluginRepositories> |
274 | | - |
| 287 | + <profiles> |
| 288 | + <profile> |
| 289 | + <id>jacoco</id> |
| 290 | + <activation> |
| 291 | + <property> |
| 292 | + <name>!jacoco.disabled</name> |
| 293 | + </property> |
| 294 | + </activation> |
| 295 | + <build> |
| 296 | + <plugins> |
| 297 | + <plugin> |
| 298 | + <groupId>org.jacoco</groupId> |
| 299 | + <artifactId>jacoco-maven-plugin</artifactId> |
| 300 | + <version>0.8.5</version> |
| 301 | + <executions> |
| 302 | + <execution> |
| 303 | + <goals> |
| 304 | + <goal>prepare-agent</goal> |
| 305 | + </goals> |
| 306 | + </execution> |
| 307 | + <!-- attached to Maven test phase --> |
| 308 | + <execution> |
| 309 | + <id>report</id> |
| 310 | + <phase>test</phase> |
| 311 | + <goals> |
| 312 | + <goal>report</goal> |
| 313 | + </goals> |
| 314 | + </execution> |
| 315 | + <execution> |
| 316 | + <id>check</id> |
| 317 | + <phase>install</phase> |
| 318 | + <goals> |
| 319 | + <goal>check</goal> |
| 320 | + </goals> |
| 321 | + <configuration> |
| 322 | + <rules> |
| 323 | + <rule> |
| 324 | + <!--We end up with chatty logs, but it shows us which particular classes --> |
| 325 | + <!--are lacking in coverage. If this is too much, just remove the --> |
| 326 | + <!--<element>CLASS</element> tag below. --> |
| 327 | + <element>CLASS</element> |
| 328 | + <limits> |
| 329 | + <!-- These limits can be overridden, in the form of `0.50` for --> |
| 330 | + <!-- 50%, as necessary. Using a property just puts it in one spot. --> |
| 331 | + <limit> |
| 332 | + <counter>LINE</counter> |
| 333 | + <value>COVEREDRATIO</value> |
| 334 | + <minimum>${jacoco.coverage.target}</minimum> |
| 335 | + </limit> |
| 336 | + <limit> |
| 337 | + <counter>BRANCH</counter> |
| 338 | + <value>COVEREDRATIO</value> |
| 339 | + <minimum>${jacoco.coverage.target}</minimum> |
| 340 | + </limit> |
| 341 | + <limit> |
| 342 | + <counter>INSTRUCTION</counter> |
| 343 | + <value>COVEREDRATIO</value> |
| 344 | + <minimum>${jacoco.coverage.target}</minimum> |
| 345 | + </limit> |
| 346 | + <limit> |
| 347 | + <counter>COMPLEXITY</counter> |
| 348 | + <value>COVEREDRATIO</value> |
| 349 | + <minimum>${jacoco.coverage.target}</minimum> |
| 350 | + </limit> |
| 351 | + <limit> |
| 352 | + <counter>METHOD</counter> |
| 353 | + <value>COVEREDRATIO</value> |
| 354 | + <minimum>${jacoco.coverage.target}</minimum> |
| 355 | + </limit> |
| 356 | + <limit> |
| 357 | + <counter>CLASS</counter> |
| 358 | + <value>COVEREDRATIO</value> |
| 359 | + <minimum>${jacoco.coverage.target}</minimum> |
| 360 | + </limit> |
| 361 | + </limits> |
| 362 | + <excludes> |
| 363 | + <exclude>org.kohsuke.github.extras.okhttp3.ObsoleteUrlFactory</exclude> |
| 364 | + <exclude>org.kohsuke.github.extras.OkHttp3Connector</exclude> |
| 365 | + <!--<exclude>io.jenkins.plugins.todeclarative.converter.api.*</exclude>--> |
| 366 | + </excludes> |
| 367 | + </rule> |
| 368 | + </rules> |
| 369 | + </configuration> |
| 370 | + </execution> |
| 371 | + </executions> |
| 372 | + </plugin> |
| 373 | + </plugins> |
| 374 | + </build> |
| 375 | + </profile> |
| 376 | + </profiles> |
275 | 377 | <reporting> |
276 | 378 | <plugins> |
277 | 379 | <plugin> |
|
0 commit comments