Class ReportSupport

java.lang.Object
org.jacoco.maven.ReportSupport

final class ReportSupport extends Object
Encapsulates the tasks to create reports for Maven projects. Instances are supposed to be used in the following sequence:
  1. Create an instance
  2. Load one or multiple exec files with loadExecutionData()
  3. Add one or multiple formatters with addXXX() methods
  4. Create the root visitor with initRootVisitor()
  5. Process one or multiple projects with processProject()
  • Field Details

    • log

      private final org.apache.maven.plugin.logging.Log log
    • loader

      private final ExecFileLoader loader
    • formatters

      private final List<IReportVisitor> formatters
  • Constructor Details

    • ReportSupport

      public ReportSupport(org.apache.maven.plugin.logging.Log log)
      Construct a new instance with the given log output.
      Parameters:
      log - for log output
  • Method Details

    • loadExecutionData

      public void loadExecutionData(File execFile) throws IOException
      Loads the given execution data file.
      Parameters:
      execFile - execution data file to load
      Throws:
      IOException - if the file can't be loaded
    • addVisitor

      public void addVisitor(IReportVisitor visitor)
    • addRulesChecker

      public void addRulesChecker(List<Rule> rules, IViolationsOutput output)
    • initRootVisitor

      public IReportVisitor initRootVisitor() throws IOException
      Throws:
      IOException
    • processProject

      public void processProject(IReportGroupVisitor visitor, org.apache.maven.project.MavenProject project, List<String> includes, List<String> excludes) throws IOException
      Calculates coverage for the given project and emits it to the report group without source references
      Parameters:
      visitor - group visitor to emit the project's coverage to
      project - the MavenProject
      includes - list of includes patterns
      excludes - list of excludes patterns
      Throws:
      IOException - if class files can't be read
    • processProject

      public void processProject(IReportGroupVisitor visitor, String bundleName, org.apache.maven.project.MavenProject project, List<String> includes, List<String> excludes, String srcEncoding) throws IOException
      Calculates coverage for the given project and emits it to the report group including source references
      Parameters:
      visitor - group visitor to emit the project's coverage to
      bundleName - name for this project in the report
      project - the MavenProject
      includes - list of includes patterns
      excludes - list of excludes patterns
      srcEncoding - encoding of the source files within this project
      Throws:
      IOException - if class files can't be read
    • processProject

      private void processProject(IReportGroupVisitor visitor, String bundleName, org.apache.maven.project.MavenProject project, List<String> includes, List<String> excludes, ISourceFileLocator locator) throws IOException
      Throws:
      IOException
    • logBundleInfo

      private void logBundleInfo(IBundleCoverage bundle, Collection<IClassCoverage> nomatch)
    • getCompileSourceRoots

      private static List<File> getCompileSourceRoots(org.apache.maven.project.MavenProject project)
    • resolvePath

      private static File resolvePath(org.apache.maven.project.MavenProject project, String path)