Class JGitBuildTimestampProvider

  • All Implemented Interfaces:
    org.eclipse.tycho.buildversion.BuildTimestampProvider

    @Component(role=org.eclipse.tycho.buildversion.BuildTimestampProvider.class,
               hint="jgit")
    public class JGitBuildTimestampProvider
    extends Object
    implements org.eclipse.tycho.buildversion.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 patters specified in <jgit.ignore> element of tycho-packaging-plugin configuration block.

    Typical usage

     ...
           <plugin>
             <groupId>org.eclipse.tycho</groupId>
             <artifactId>tycho-packaging-plugin</artifactId>
             <version>${tycho-version}</version>
             <dependencies>
               <dependency>
                 <groupId>org.eclipse.tycho.extras</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 Detail

      • JGitBuildTimestampProvider

        public JGitBuildTimestampProvider()
    • Method Detail

      • 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 org.eclipse.tycho.buildversion.BuildTimestampProvider
        Throws:
        org.apache.maven.plugin.MojoExecutionException