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 FileBase directory of the project.protected StringGit branch name.File paths to additional Cobertura coverage report files.protected FileFile path to write and submit Coveralls data.protected StringUrl for the Coveralls API.protected booleanDry run Coveralls report without actually sending it.protected booleanFail build if Coveralls service is not available or submission fails for internal errors.File paths to additional JaCoCo coverage report files.protected booleanCoveralls parallel flag.protected org.apache.maven.project.MavenProjectMaven project for runtime value resolution.protected StringGitHub pull request identifier.Directories for relative per module specific report files.protected StringCoveralls repository token.File paths to additional Saga coverage report files.protected booleanScan subdirectories for source files.protected StringCI service build number.protected StringCI service build url.protected PropertiesCI service specific environment properties.protected StringCI service job id.protected StringCI service name.protected org.apache.maven.settings.SettingsMaven settings.protected booleanSkip the plugin execution.Source directories.protected StringSource file encoding.protected StringBuild timestamp.protected StringBuild 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 CoverallsClientCreates the coveralls client.protected EnvironmentCreates the environment.protected JobCreates the job.protected JsonWritercreateJsonWriter(Job job) Creates the json writer.protected SourceCallbackcreateSourceCallbackChain(JsonWriter writer, List<Logger> reporters) Creates the source callback chain.protected SourceLoadercreateSourceLoader(Job job) Creates the source loader.final voidexecute()protected List<ServiceSetup> Gets the services.protected voidwriteCoveralls(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.MojoExecutionExceptionorg.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
-