|
56 | 56 | <maven.javadoc.skip>false</maven.javadoc.skip> |
57 | 57 | <maven.javadoc.failOnError>false</maven.javadoc.failOnError> |
58 | 58 | <maven.build.timestamp.format>yyyy-MM-dd'T'HH:mm:ss</maven.build.timestamp.format> |
| 59 | + <!-- JaCoCo Properties --> |
| 60 | + <jacoco.version>0.8.13</jacoco.version> |
| 61 | + <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin> |
| 62 | + <sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis> |
| 63 | + <sonar.coverage.jacoco.xmlReportPaths>${project.reporting.outputDirectory}/jacoco-ut/jacoco.xml</sonar.coverage.jacoco.xmlReportPaths> |
| 64 | + <sonar.language>java</sonar.language> |
59 | 65 | </properties> |
60 | 66 | <!-- At root project level defining dependencies useable across all projects. |
61 | 67 | Making version management easy and consistent! --> |
|
468 | 474 | <artifactId>maven-resources-plugin</artifactId> |
469 | 475 | <version>3.3.1</version> |
470 | 476 | </plugin> |
| 477 | + <plugin> |
| 478 | + <groupId>org.jacoco</groupId> |
| 479 | + <artifactId>jacoco-maven-plugin</artifactId> |
| 480 | + <version>${jacoco.version}</version> |
| 481 | + <executions> |
| 482 | + <!-- |
| 483 | + Prepares the property pointing to the JaCoCo propruntime agent which |
| 484 | + is passed as VM argument when Maven the Surefire plugin is executed. |
| 485 | + --> |
| 486 | + <execution> |
| 487 | + <id>pre-unit-test</id> |
| 488 | + <goals> |
| 489 | + <goal>prepare-agent</goal> |
| 490 | + </goals> |
| 491 | + <configuration> |
| 492 | + <!-- Sets the path to the file which contains the execution data. --> |
| 493 | + <destFile>${project.build.directory}/coverage-reports/jacoco-ut.exec</destFile> |
| 494 | + <!-- |
| 495 | + Sets the name of the property containing the settings |
| 496 | + for JaCoCo runtime agent. |
| 497 | + --> |
| 498 | + <propertyName>surefireArgLine</propertyName> |
| 499 | + </configuration> |
| 500 | + </execution> |
| 501 | + <!-- |
| 502 | + Ensures that the code coverage report for unit tests is created after |
| 503 | + unit tests have been run. |
| 504 | + --> |
| 505 | + <execution> |
| 506 | + <id>post-unit-test</id> |
| 507 | + <phase>test</phase> |
| 508 | + <goals> |
| 509 | + <goal>report</goal> |
| 510 | + </goals> |
| 511 | + <configuration> |
| 512 | + <!-- Sets the path to the file which contains the execution data. --> |
| 513 | + <dataFile>${project.build.directory}/coverage-reports/jacoco-ut.exec</dataFile> |
| 514 | + <!-- Sets the output directory for the code coverage report. --> |
| 515 | + <outputDirectory>${project.reporting.outputDirectory}/jacoco-ut</outputDirectory> |
| 516 | + <formats> |
| 517 | + <format>XML</format> |
| 518 | + <format>CSV</format> |
| 519 | + </formats> |
| 520 | + </configuration> |
| 521 | + </execution> |
| 522 | + </executions> |
| 523 | + </plugin> |
471 | 524 | </plugins> |
472 | 525 | </pluginManagement> |
| 526 | + <plugins> |
| 527 | + |
| 528 | + <plugin> |
| 529 | + <groupId>org.jacoco</groupId> |
| 530 | + <artifactId>jacoco-maven-plugin</artifactId> |
| 531 | + <executions> |
| 532 | + <!-- Aggregate reports from all modules --> |
| 533 | + <execution> |
| 534 | + <id>merge-results</id> |
| 535 | + <phase>verify</phase> |
| 536 | + <goals> |
| 537 | + <goal>merge</goal> |
| 538 | + </goals> |
| 539 | + <configuration> |
| 540 | + <fileSets> |
| 541 | + <fileSet> |
| 542 | + <directory>${project.basedir}</directory> |
| 543 | + <includes> |
| 544 | + <include>**/target/coverage-reports/jacoco-ut.exec</include> |
| 545 | + </includes> |
| 546 | + </fileSet> |
| 547 | + </fileSets> |
| 548 | + <destFile>${project.build.directory}/coverage-reports/merged-jacoco-ut.exec</destFile> |
| 549 | + </configuration> |
| 550 | + </execution> |
| 551 | + <execution> |
| 552 | + <id>aggregate-report</id> |
| 553 | + <phase>verify</phase> |
| 554 | + <goals> |
| 555 | + <goal>report-aggregate</goal> |
| 556 | + </goals> |
| 557 | + <configuration> |
| 558 | + <dataFileIncludes> |
| 559 | + <dataFileInclude>**/coverage-reports/merged-jacoco-ut.exec</dataFileInclude> |
| 560 | + </dataFileIncludes> |
| 561 | + <outputDirectory>${project.reporting.outputDirectory}/jacoco-aggregate</outputDirectory> |
| 562 | + </configuration> |
| 563 | + </execution> |
| 564 | + </executions> |
| 565 | + </plugin> |
| 566 | + </plugins> |
473 | 567 | </build> |
474 | 568 | <profiles> |
475 | 569 | <profile> |
|
0 commit comments