Class JGitBuildTimestampProvider

java.lang.Object
org.eclipse.tycho.extras.buildtimestamp.jgit.JGitBuildTimestampProvider
All Implemented Interfaces:
BuildTimestampProvider

@Component(role=org.eclipse.tycho.build.BuildTimestampProvider.class, hint="jgit") public class JGitBuildTimestampProvider extends Object implements BuildTimestampProvider
Build timestamp provider that returns date of the most recent git commit that touches any file under project basedir. Because this timestamp provider is meant to be used for reproducible builds, by default an exception is thrown if git status is not clean (i.e. uncommitted changes are detected).

If uncommitted changes should be tolerated with a warning, configure

 <jgit.dirtyWorkingTree>warning</jgit.dirtyWorkingTree>
 
In this case, this timestamp provider will delegate to the default timestamp provider which uses the current build timestamp.

For additional flexibility, some files can be ignored using gitignore patterns specified in &ltjgit.ignore> element of tycho-packaging-plugin configuration block. Like in a .gitignore file each pattern is separated by a newline (unix or windows style) or form-feed.

Typical usage

 ...
       <plugin>
         <groupId>org.eclipse.tycho</groupId>
         <artifactId>tycho-packaging-plugin</artifactId>
         <version>${tycho-version}</version>
         <dependencies>
           <dependency>
             <groupId>org.eclipse.tycho</groupId>
             <artifactId>tycho-buildtimestamp-jgit</artifactId>
             <version>${tycho-version}</version>
           </dependency>
         </dependencies>
         <configuration>
           <timestampProvider>jgit</timestampProvider>
           <jgit.ignore>pom.xml</jgit.ignore>
         </configuration>
       </plugin>
 ...
 
  • Constructor Details

    • JGitBuildTimestampProvider

      public JGitBuildTimestampProvider()
  • Method Details

    • getTimestamp

      public Date getTimestamp(org.apache.maven.execution.MavenSession session, org.apache.maven.project.MavenProject project, org.apache.maven.plugin.MojoExecution execution) throws org.apache.maven.plugin.MojoExecutionException
      Specified by:
      getTimestamp in interface BuildTimestampProvider
      Throws:
      org.apache.maven.plugin.MojoExecutionException
    • setQuiet

      public void setQuiet(boolean quiet)
      Specified by:
      setQuiet in interface BuildTimestampProvider