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.AbstractMojoPuts git build-time information into property files or maven's properties.- Since:
- 1.0
-
-
Constructor Summary
Constructors Constructor Description GitCommitIdMojo()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidexecute()protected java.util.Map<java.lang.String,java.lang.String>getCustomSystemEnv()This method is used to mock the system environment in testing.protected static java.util.DateparseOutputTimestamp(java.lang.String outputTimestamp)Parse output timestamp configured for Reproducible Builds' archive entries (https://maven.apache.org/guides/mini/guide-reproducible-builds.html).
-
-
-
Method Detail
-
getCustomSystemEnv
protected java.util.Map<java.lang.String,java.lang.String> 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
protected static java.util.Date parseOutputTimestamp(java.lang.String outputTimestamp)
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
-
-