Class CoverallsReportMojo

java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.eluder.coveralls.maven.plugin.CoverallsReportMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo

@Mojo(name="report", threadSafe=false, aggregator=true) public class CoverallsReportMojo extends org.apache.maven.plugin.AbstractMojo
  • Field Details

    • jacocoReports

      @Parameter(property="jacocoReports") protected List<File> jacocoReports
      File paths to additional JaCoCo coverage report files.
    • coberturaReports

      @Parameter(property="coberturaReports") protected List<File> coberturaReports
      File paths to additional Cobertura coverage report files.
    • sagaReports

      @Parameter(property="sagaReports") protected List<File> sagaReports
      File paths to additional Saga coverage report files.
    • relativeReportDirs

      @Parameter(property="relativeReportDirs") protected List<String> relativeReportDirs
      Directories for relative per module specific report files.
    • coverallsFile

      @Parameter(property="coverallsFile", defaultValue="${project.build.directory}/coveralls.json") protected File coverallsFile
      File path to write and submit Coveralls data.
    • coverallsUrl

      @Parameter(property="coverallsUrl", defaultValue="https://coveralls.io/api/v1/jobs") protected String coverallsUrl
      Url for the Coveralls API.
    • sourceDirectories

      @Parameter(property="sourceDirectories") protected List<File> sourceDirectories
      Source directories.
    • sourceEncoding

      @Parameter(property="sourceEncoding", defaultValue="${project.build.sourceEncoding}") protected String sourceEncoding
      Source file encoding.
    • serviceName

      @Parameter(property="serviceName") protected String serviceName
      CI service name.
    • serviceJobId

      @Parameter(property="serviceJobId") protected String serviceJobId
      CI service job id.
    • serviceBuildNumber

      @Parameter(property="serviceBuildNumber") protected String serviceBuildNumber
      CI service build number.
    • serviceBuildUrl

      @Parameter(property="serviceBuildUrl") protected String serviceBuildUrl
      CI service build url.
    • serviceEnvironment

      @Parameter(property="serviceEnvironment") protected Properties serviceEnvironment
      CI service specific environment properties.
    • repoToken

      @Parameter(property="repoToken") protected String repoToken
      Coveralls repository token.
    • branch

      @Parameter(property="branch") protected String branch
      Git branch name.
    • pullRequest

      @Parameter(property="pullRequest") protected String pullRequest
      GitHub pull request identifier.
    • parallel

      @Parameter(property="parallel") protected boolean parallel
      Coveralls parallel flag.
    • timestampFormat

      @Parameter(property="timestampFormat", defaultValue="${maven.build.timestamp.format}") protected String timestampFormat
      Build timestamp format. Must be in format supported by SimpleDateFormat.
    • timestamp

      @Parameter(property="timestamp", defaultValue="${maven.build.timestamp}") protected String timestamp
      Build timestamp. Must be in format defined by 'timestampFormat' if it's available or in default timestamp format yyyy-MM-dd'T'HH:mm:ss'Z'.
    • dryRun

      @Parameter(property="dryRun", defaultValue="false") protected boolean dryRun
      Dry run Coveralls report without actually sending it.
    • failOnServiceError

      @Parameter(property="failOnServiceError", defaultValue="true") protected boolean failOnServiceError
      Fail build if Coveralls service is not available or submission fails for internal errors.
    • scanForSources

      @Parameter(property="scanForSources", defaultValue="false") protected boolean scanForSources
      Scan subdirectories for source files.
    • basedir

      @Parameter(property="coveralls.basedir", defaultValue="${project.basedir}") protected File basedir
      Base directory of the project.
    • skip

      @Parameter(property="coveralls.skip", defaultValue="false") protected boolean skip
      Skip the plugin execution.
    • settings

      @Parameter(defaultValue="${settings}", readonly=true, required=true) protected org.apache.maven.settings.Settings settings
      Maven settings.
    • project

      @Parameter(defaultValue="${project}", readonly=true) protected org.apache.maven.project.MavenProject project
      Maven project for runtime value resolution.
  • Constructor Details

    • CoverallsReportMojo

      public CoverallsReportMojo()
  • Method Details

    • execute

      public final void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
      Throws:
      org.apache.maven.plugin.MojoExecutionException
      org.apache.maven.plugin.MojoFailureException
    • createCoverageParsers

      protected List<CoverageParser> createCoverageParsers(SourceLoader sourceLoader) throws IOException
      Creates the coverage parsers.
      Parameters:
      sourceLoader - source loader that extracts source files
      Returns:
      coverage parsers for all maven modules and additional reports
      Throws:
      IOException - if parsers cannot be created
    • createSourceLoader

      protected SourceLoader createSourceLoader(Job job)
      Creates the source loader.
      Parameters:
      job - the job describing the coveralls report
      Returns:
      source loader that extracts source files
    • createEnvironment

      protected Environment createEnvironment()
      Creates the environment.
      Returns:
      environment to setup mojo and service specific properties
    • getServices

      protected List<ServiceSetup> getServices()
      Gets the services.
      Returns:
      list of available continuous integration services
    • createJob

      protected Job createJob() throws ProcessingException, IOException
      Creates the job.
      Returns:
      job that describes the coveralls report
      Throws:
      ProcessingException - if processing of timestamp fails
      IOException - if an I/O error occurs
    • createJsonWriter

      protected JsonWriter createJsonWriter(Job job) throws IOException
      Creates the json writer.
      Parameters:
      job - the job describing the coveralls report
      Returns:
      JSON writer that writes the coveralls data
      Throws:
      IOException - if an I/O error occurs
    • createCoverallsClient

      protected CoverallsClient createCoverallsClient()
      Creates the coveralls client.
      Returns:
      http client that submits the coveralls data
    • createSourceCallbackChain

      protected SourceCallback createSourceCallbackChain(JsonWriter writer, List<Logger> reporters)
      Creates the source callback chain.
      Parameters:
      writer - the JSON writer
      reporters - the logging reporters
      Returns:
      source callback chain for different source handlers
    • writeCoveralls

      protected void writeCoveralls(JsonWriter writer, SourceCallback sourceCallback, List<CoverageParser> parsers) throws ProcessingException, IOException
      Writes coverage data to JSON file.
      Parameters:
      writer - JSON writer that writes the coveralls data
      sourceCallback - the source callback handler
      parsers - list of coverage parsers
      Throws:
      ProcessingException - if process to to create JSON file fails
      IOException - if an I/O error occurs