Package org.jacoco.maven
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 boolean
Include this project in the report.private File
Output directory for the reports.private List<org.apache.maven.project.MavenProject>
The projects in the reactor.Fields inherited from class org.jacoco.maven.AbstractReportMojo
excludes, footer, formats, includes, outputEncoding, project, skip, sourceEncoding, title
Fields inherited from interface org.apache.maven.reporting.MavenReport
CATEGORY_PROJECT_INFORMATION, CATEGORY_PROJECT_REPORTS, ROLE
Fields 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) void
createReport
(IReportGroupVisitor visitor, ReportSupport support) private List<org.apache.maven.project.MavenProject>
findDependencies
(String... scopes) 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.(package private) File
(package private) void
loadExecutionData
(ReportSupport support) private void
loadExecutionData
(ReportSupport support, FileFilter filter, File basedir) private void
processProject
(ReportSupport support, IReportGroupVisitor group, org.apache.maven.project.MavenProject project) void
setReportOutputDirectory
(File reportOutputDirectory) Methods inherited from class org.jacoco.maven.AbstractReportMojo
canGenerateReport, execute, generate, generate, getCategoryName, getDescription, getExcludes, getIncludes, isExternalReport
Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
Field Details
-
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
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 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:
canGenerateReportRegardingDataFiles
in classAbstractReportMojo
-
canGenerateReportRegardingClassesDirectory
boolean canGenerateReportRegardingClassesDirectory()- Specified by:
canGenerateReportRegardingClassesDirectory
in classAbstractReportMojo
-
loadExecutionData
- Specified by:
loadExecutionData
in classAbstractReportMojo
- Throws:
IOException
-
loadExecutionData
private void loadExecutionData(ReportSupport support, FileFilter filter, File basedir) throws IOException - Throws:
IOException
-
getOutputDirectory
File getOutputDirectory()- Specified by:
getOutputDirectory
in classAbstractReportMojo
-
createReport
- Specified by:
createReport
in 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.
-