Package pl.project13.maven.git
Class GitCommitIdMojo
java.lang.Object
org.apache.maven.plugin.AbstractMojo
pl.project13.maven.git.GitCommitIdMojo
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
@Mojo(name="revision",
defaultPhase=INITIALIZE,
threadSafe=true)
public class GitCommitIdMojo
extends org.apache.maven.plugin.AbstractMojo
Puts git build-time information into property files or maven's properties.
- Since:
- 1.0
-
Field Summary
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidexecute()This method is used to mock the system environment in testing.protected static DateparseOutputTimestamp(String outputTimestamp) Parse output timestamp configured for Reproducible Builds' archive entries (https://maven.apache.org/guides/mini/guide-reproducible-builds.html).Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
Constructor Details
-
GitCommitIdMojo
public GitCommitIdMojo()
-
-
Method Details
-
getCustomSystemEnv
This method is used to mock the system environment in testing.- Returns:
- unmodifiable string map view of the current system environment
System.getenv(java.lang.String).
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionException- Throws:
org.apache.maven.plugin.MojoExecutionException
-
parseOutputTimestamp
Parse output timestamp configured for Reproducible Builds' archive entries (https://maven.apache.org/guides/mini/guide-reproducible-builds.html). The value from${project.build.outputTimestamp}is either formatted as ISO 8601yyyy-MM-dd'T'HH:mm:ssXXXor as an int representing seconds since the epoch (like SOURCE_DATE_EPOCH.Inspired by https://github.com/apache/maven-archiver/blob/7acb1db4a9754beacde3f21a69e5523ee901abd5/src/main/java/org/apache/maven/archiver/MavenArchiver.java#L755
- Parameters:
outputTimestamp- the value of${project.build.outputTimestamp}(may benull)- Returns:
- the parsed timestamp, may be
nullifnullinput or input contains only 1 character
-