Class ReportAggregateMojo
java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.jacoco.maven.AbstractReportMojo
org.jacoco.maven.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 Summary
FieldsModifier and TypeFieldDescriptionA list of execution data files to exclude from the report.A list of execution data files to include in the report from each project.private booleanInclude this project in the report.private FileOutput directory for the reports.private List<org.apache.maven.project.MavenProject> The projects in the reactor.Fields inherited from class AbstractReportMojo
excludes, footer, formats, includes, outputEncoding, project, skip, sourceEncoding, titleFields inherited from interface org.apache.maven.reporting.MavenReport
CATEGORY_PROJECT_INFORMATION, CATEGORY_PROJECT_REPORTS, ROLEFields inherited from interface org.apache.maven.plugin.Mojo
ROLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) boolean(package private) boolean(package private) voidcreateReport(IReportGroupVisitor visitor, ReportSupport support) private List<org.apache.maven.project.MavenProject> findDependencies(String... scopes) private org.apache.maven.project.MavenProjectfindProjectFromReactor(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.(package private) File(package private) voidloadExecutionData(ReportSupport support) private voidloadExecutionData(ReportSupport support, FileFilter filter, File basedir) private voidprocessProject(ReportSupport support, IReportGroupVisitor group, org.apache.maven.project.MavenProject project) voidsetReportOutputDirectory(File reportOutputDirectory) Methods inherited from class AbstractReportMojo
canGenerateReport, execute, generate, generate, getCategoryName, getDescription, getExcludes, getIncludes, isExternalReportMethods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContextMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.maven.reporting.MavenReport
getOutputPath
-
Field Details
-
dataFileIncludes
-
dataFileExcludes
-
outputDirectory
@Parameter(defaultValue="${project.reporting.outputDirectory}/jacoco-aggregate") private File outputDirectoryOutput 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 includeCurrentProjectInclude 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 List<org.apache.maven.project.MavenProject> reactorProjectsThe projects in the reactor.
-
-
Constructor Details
-
ReportAggregateMojo
public ReportAggregateMojo()
-
-
Method Details
-
canGenerateReportRegardingDataFiles
boolean canGenerateReportRegardingDataFiles()- Specified by:
canGenerateReportRegardingDataFilesin classAbstractReportMojo
-
canGenerateReportRegardingClassesDirectory
boolean canGenerateReportRegardingClassesDirectory()- Specified by:
canGenerateReportRegardingClassesDirectoryin classAbstractReportMojo
-
loadExecutionData
- Specified by:
loadExecutionDatain classAbstractReportMojo- Throws:
IOException
-
loadExecutionData
private void loadExecutionData(ReportSupport support, FileFilter filter, File basedir) throws IOException - Throws:
IOException
-
getOutputDirectory
File getOutputDirectory()- Specified by:
getOutputDirectoryin classAbstractReportMojo
-
createReport
- Specified by:
createReportin classAbstractReportMojo- Throws:
IOException
-
processProject
private void processProject(ReportSupport support, IReportGroupVisitor group, org.apache.maven.project.MavenProject project) throws IOException - Throws:
IOException
-
getReportOutputDirectory
-
setReportOutputDirectory
-
getOutputName
-
getName
-
findDependencies
-
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.
-