Package org.jacoco.maven
Class ReportAggregateMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- org.apache.maven.reporting.AbstractMavenReport
-
- 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. 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>
dataFileExcludes
A list of execution data files to exclude from the report.(package private) java.util.List<java.lang.String>
dataFileIncludes
A list of execution data files to include in the report from each project.private java.io.File
outputDirectory
Output directory for the reports.private java.util.List<org.apache.maven.project.MavenProject>
reactorProjects
The projects in the reactor.-
Fields inherited from class org.jacoco.maven.AbstractReportMojo
excludes, footer, includes, outputEncoding, project, siteRenderer, skip, sourceEncoding, title
-
-
Constructor Summary
Constructors Constructor Description ReportAggregateMojo()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) void
addFormatters(ReportSupport support, java.util.Locale locale)
(package private) boolean
canGenerateReportRegardingClassesDirectory()
(package private) boolean
canGenerateReportRegardingDataFiles()
(package private) void
createReport(IReportGroupVisitor visitor, ReportSupport support)
private java.util.List<org.apache.maven.project.MavenProject>
findDependencies(java.lang.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.java.lang.String
getName(java.util.Locale locale)
protected java.lang.String
getOutputDirectory()
java.lang.String
getOutputName()
(package private) void
loadExecutionData(ReportSupport support)
private void
loadExecutionData(ReportSupport support, FileFilter filter, java.io.File basedir)
void
setReportOutputDirectory(java.io.File reportOutputDirectory)
-
Methods inherited from class org.jacoco.maven.AbstractReportMojo
canGenerateReport, execute, executeReport, getDescription, getExcludes, getIncludes, getProject, getSiteRenderer, isExternalReport
-
Methods inherited from class org.apache.maven.reporting.AbstractMavenReport
closeReport, generate, generate, generate, getCategoryName, getInputEncoding, getOutputEncoding, getReportOutputDirectory, getSink, getSinkFactory
-
-
-
-
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.
-
reactorProjects
@Parameter(property="reactorProjects", readonly=true) private java.util.List<org.apache.maven.project.MavenProject> reactorProjects
The projects in the reactor.
-
-
Method Detail
-
canGenerateReportRegardingDataFiles
boolean canGenerateReportRegardingDataFiles()
- Specified by:
canGenerateReportRegardingDataFiles
in classAbstractReportMojo
-
canGenerateReportRegardingClassesDirectory
boolean canGenerateReportRegardingClassesDirectory()
- Specified by:
canGenerateReportRegardingClassesDirectory
in classAbstractReportMojo
-
loadExecutionData
void loadExecutionData(ReportSupport support) throws java.io.IOException
- Specified by:
loadExecutionData
in 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
-
addFormatters
void addFormatters(ReportSupport support, java.util.Locale locale) throws java.io.IOException
- Specified by:
addFormatters
in classAbstractReportMojo
- Throws:
java.io.IOException
-
createReport
void createReport(IReportGroupVisitor visitor, ReportSupport support) throws java.io.IOException
- Specified by:
createReport
in classAbstractReportMojo
- Throws:
java.io.IOException
-
getOutputDirectory
protected java.lang.String getOutputDirectory()
- Overrides:
getOutputDirectory
in classorg.apache.maven.reporting.AbstractMavenReport
-
setReportOutputDirectory
public void setReportOutputDirectory(java.io.File reportOutputDirectory)
- Specified by:
setReportOutputDirectory
in interfaceorg.apache.maven.reporting.MavenReport
- Overrides:
setReportOutputDirectory
in classorg.apache.maven.reporting.AbstractMavenReport
-
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.
-
-