Class ReportAggregateMojo

  • All Implemented Interfaces:
    org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo, org.apache.maven.reporting.MavenMultiPageReport, org.apache.maven.reporting.MavenReport

    @Mojo(name="report-aggregate",
          threadSafe=true)
    public class ReportAggregateMojo
    extends AbstractReportMojo

    Creates a structured code coverage report (HTML, XML, and CSV) from multiple projects within reactor. The report is created from all modules this project depends on, and optionally this project itself. From those projects class and source files as well as JaCoCo execution data files will be collected. In addition execution data is collected from the project itself. This also allows to create coverage reports when tests are in separate projects than the code under test, for example in case of integration tests.

    Using the dependency scope allows to distinguish projects which contribute execution data but should not become part of the report:

    • compile, runtime, provided: Project source and execution data is included in the report.
    • test: Only execution data is considered for the report.
    Since:
    0.7.7
    • Field Detail

      • dataFileIncludes

        @Parameter
        java.util.List<java.lang.String> dataFileIncludes
        A list of execution data files to include in the report from each project. May use wildcard characters (* and ?). When not specified all *.exec files from the target folder will be included.
      • dataFileExcludes

        @Parameter
        java.util.List<java.lang.String> dataFileExcludes
        A list of execution data files to exclude from the report. May use wildcard characters (* and ?). When not specified nothing will be excluded.
      • outputDirectory

        @Parameter(defaultValue="${project.reporting.outputDirectory}/jacoco-aggregate")
        private java.io.File outputDirectory
        Output directory for the reports. Note that this parameter is only relevant if the goal is run from the command line or from the default build lifecycle. If the goal is run indirectly as part of a site generation, the output directory configured in the Maven Site Plugin is used instead.
      • includeCurrentProject

        @Parameter(defaultValue="false")
        private boolean includeCurrentProject
        Include this project in the report. If true then this projects class and source files as well as JaCoCo execution data files will be collected.
        Since:
        0.8.9
      • reactorProjects

        @Parameter(property="reactorProjects",
                   readonly=true)
        private java.util.List<org.apache.maven.project.MavenProject> reactorProjects
        The projects in the reactor.
    • Constructor Detail

      • ReportAggregateMojo

        public ReportAggregateMojo()
    • Method Detail

      • loadExecutionData

        private void loadExecutionData​(ReportSupport support,
                                       FileFilter filter,
                                       java.io.File basedir)
                                throws java.io.IOException
        Throws:
        java.io.IOException
      • processProject

        private void processProject​(ReportSupport support,
                                    IReportGroupVisitor group,
                                    org.apache.maven.project.MavenProject project)
                             throws java.io.IOException
        Throws:
        java.io.IOException
      • getReportOutputDirectory

        public java.io.File getReportOutputDirectory()
      • setReportOutputDirectory

        public void setReportOutputDirectory​(java.io.File reportOutputDirectory)
      • getOutputName

        public java.lang.String getOutputName()
      • getName

        public java.lang.String getName​(java.util.Locale locale)
      • findDependencies

        private java.util.List<org.apache.maven.project.MavenProject> findDependencies​(java.lang.String... scopes)
      • findProjectFromReactor

        private org.apache.maven.project.MavenProject findProjectFromReactor​(org.apache.maven.model.Dependency d)
        Note that if dependency specified using version range and reactor contains multiple modules with same artifactId and groupId but of different versions, then first dependency which matches range will be selected. For example in case of range [0,2] if version 1 is before version 2 in reactor, then version 1 will be selected.