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 Summary
FieldsModifier and TypeFieldDescriptionprotected File
Base directory of the project.protected String
Git branch name.File paths to additional Cobertura coverage report files.protected File
File path to write and submit Coveralls data.protected String
Url for the Coveralls API.protected boolean
Dry run Coveralls report without actually sending it.protected boolean
Fail build if Coveralls service is not available or submission fails for internal errors.File paths to additional JaCoCo coverage report files.protected boolean
Coveralls parallel flag.protected org.apache.maven.project.MavenProject
Maven project for runtime value resolution.protected String
GitHub pull request identifier.Directories for relative per module specific report files.protected String
Coveralls repository token.File paths to additional Saga coverage report files.protected boolean
Scan subdirectories for source files.protected String
CI service build number.protected String
CI service build url.protected Properties
CI service specific environment properties.protected String
CI service job id.protected String
CI service name.protected org.apache.maven.settings.Settings
Maven settings.protected boolean
Skip the plugin execution.Source directories.protected String
Source file encoding.protected String
Build timestamp.protected String
Build timestamp format.Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected List
<CoverageParser> createCoverageParsers
(SourceLoader sourceLoader) Creates the coverage parsers.protected CoverallsClient
Creates the coveralls client.protected Environment
Creates the environment.protected Job
Creates the job.protected JsonWriter
createJsonWriter
(Job job) Creates the json writer.protected SourceCallback
createSourceCallbackChain
(JsonWriter writer, List<Logger> reporters) Creates the source callback chain.protected SourceLoader
createSourceLoader
(Job job) Creates the source loader.final void
execute()
protected List
<ServiceSetup> Gets the services.protected void
writeCoveralls
(JsonWriter writer, SourceCallback sourceCallback, List<CoverageParser> parsers) Writes coverage data to JSON file.Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
Field Details
-
jacocoReports
File paths to additional JaCoCo coverage report files. -
coberturaReports
File paths to additional Cobertura coverage report files. -
sagaReports
File paths to additional Saga coverage report files. -
relativeReportDirs
Directories for relative per module specific report files. -
coverallsFile
@Parameter(property="coverallsFile", defaultValue="${project.build.directory}/coveralls.json") protected File coverallsFileFile path to write and submit Coveralls data. -
coverallsUrl
@Parameter(property="coverallsUrl", defaultValue="https://coveralls.io/api/v1/jobs") protected String coverallsUrlUrl for the Coveralls API. -
sourceDirectories
Source directories. -
sourceEncoding
@Parameter(property="sourceEncoding", defaultValue="${project.build.sourceEncoding}") protected String sourceEncodingSource file encoding. -
serviceName
CI service name. -
serviceJobId
CI service job id. -
serviceBuildNumber
CI service build number. -
serviceBuildUrl
CI service build url. -
serviceEnvironment
CI service specific environment properties. -
repoToken
Coveralls repository token. -
branch
Git branch name. -
pullRequest
GitHub pull request identifier. -
parallel
@Parameter(property="parallel") protected boolean parallelCoveralls parallel flag. -
timestampFormat
@Parameter(property="timestampFormat", defaultValue="${maven.build.timestamp.format}") protected String timestampFormatBuild timestamp format. Must be in format supported by SimpleDateFormat. -
timestamp
@Parameter(property="timestamp", defaultValue="${maven.build.timestamp}") protected String timestampBuild 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 dryRunDry run Coveralls report without actually sending it. -
failOnServiceError
@Parameter(property="failOnServiceError", defaultValue="true") protected boolean failOnServiceErrorFail build if Coveralls service is not available or submission fails for internal errors. -
scanForSources
@Parameter(property="scanForSources", defaultValue="false") protected boolean scanForSourcesScan subdirectories for source files. -
basedir
Base directory of the project. -
skip
@Parameter(property="coveralls.skip", defaultValue="false") protected boolean skipSkip the plugin execution. -
settings
@Parameter(defaultValue="${settings}", readonly=true, required=true) protected org.apache.maven.settings.Settings settingsMaven settings. -
project
@Parameter(defaultValue="${project}", readonly=true) protected org.apache.maven.project.MavenProject projectMaven 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
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
Creates the source loader.- Parameters:
job
- the job describing the coveralls report- Returns:
- source loader that extracts source files
-
createEnvironment
Creates the environment.- Returns:
- environment to setup mojo and service specific properties
-
getServices
Gets the services.- Returns:
- list of available continuous integration services
-
createJob
Creates the job.- Returns:
- job that describes the coveralls report
- Throws:
ProcessingException
- if processing of timestamp failsIOException
- if an I/O error occurs
-
createJsonWriter
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
Creates the coveralls client.- Returns:
- http client that submits the coveralls data
-
createSourceCallbackChain
Creates the source callback chain.- Parameters:
writer
- the JSON writerreporters
- 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 datasourceCallback
- the source callback handlerparsers
- list of coverage parsers- Throws:
ProcessingException
- if process to to create JSON file failsIOException
- if an I/O error occurs
-