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 AbstractReportMojoCreates 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
Fields Modifier and Type Field Description (package private) java.util.List<java.lang.String>dataFileExcludesA list of execution data files to exclude from the report.(package private) java.util.List<java.lang.String>dataFileIncludesA list of execution data files to include in the report from each project.private booleanincludeCurrentProjectInclude this project in the report.private java.io.FileoutputDirectoryOutput directory for the reports.private java.util.List<org.apache.maven.project.MavenProject>reactorProjectsThe projects in the reactor.-
Fields inherited from class org.jacoco.maven.AbstractReportMojo
excludes, footer, formats, includes, outputEncoding, project, skip, sourceEncoding, title
-
-
Constructor Summary
Constructors Constructor Description ReportAggregateMojo()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) booleancanGenerateReportRegardingClassesDirectory()(package private) booleancanGenerateReportRegardingDataFiles()(package private) voidcreateReport(IReportGroupVisitor visitor, ReportSupport support)private java.util.List<org.apache.maven.project.MavenProject>findDependencies(java.lang.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.java.lang.StringgetName(java.util.Locale locale)(package private) java.io.FilegetOutputDirectory()java.lang.StringgetOutputName()java.io.FilegetReportOutputDirectory()(package private) voidloadExecutionData(ReportSupport support)private voidloadExecutionData(ReportSupport support, FileFilter filter, java.io.File basedir)private voidprocessProject(ReportSupport support, IReportGroupVisitor group, org.apache.maven.project.MavenProject project)voidsetReportOutputDirectory(java.io.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 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 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 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> reactorProjectsThe projects in the reactor.
-
-
Method Detail
-
canGenerateReportRegardingDataFiles
boolean canGenerateReportRegardingDataFiles()
- Specified by:
canGenerateReportRegardingDataFilesin classAbstractReportMojo
-
canGenerateReportRegardingClassesDirectory
boolean canGenerateReportRegardingClassesDirectory()
- Specified by:
canGenerateReportRegardingClassesDirectoryin classAbstractReportMojo
-
loadExecutionData
void loadExecutionData(ReportSupport support) throws java.io.IOException
- Specified by:
loadExecutionDatain classAbstractReportMojo- Throws:
java.io.IOException
-
loadExecutionData
private void loadExecutionData(ReportSupport support, FileFilter filter, java.io.File basedir) throws java.io.IOException
- Throws:
java.io.IOException
-
getOutputDirectory
java.io.File getOutputDirectory()
- Specified by:
getOutputDirectoryin classAbstractReportMojo
-
createReport
void createReport(IReportGroupVisitor visitor, ReportSupport support) throws java.io.IOException
- Specified by:
createReportin classAbstractReportMojo- 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.
-
-