On 5. Nov 2019, at 15:24, Marshall Schor <[email protected]> wrote:
> 
> re: We might care considering enhancing the build process such that is stores
> the commit ID from which the release is carved into some file.
> 
> I think the release:prepare / release:perform does this.. 
> 
>    The "prepare" creates the non-snapshot version of the source code,
>     commits it and tags it with the non-snapshot version number
> 
>    The "perform" checks out that specific tag and builds from that.
>    So there ought to be some guarantee of a match between the tag and what 
> gets
> built.

I mean including a file which contains the commit ID into the actual release 
artifacts using the Maven resources filtering and the buildnumber plugin.

https://maven.apache.org/plugins/maven-resources-plugin/examples/filter.html

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>buildnumber-maven-plugin</artifactId>
        <version>1.3</version>
        <executions>
          <execution>
            <phase>validate</phase>
            <goals>
              <goal>create</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <timestampFormat>{0,date,yyyy-MM-dd HH:mm:ss}</timestampFormat>
          <doCheck>false</doCheck>
          <doUpdate>false</doUpdate>
        </configuration>
      </plugin>

Example filter configuration:

  
https://github.com/webanno/webanno/blob/master/webanno-webapp/src/main/filter/filter.properties

Example filtered file:

  
https://github.com/webanno/webanno/blob/master/webanno-webapp/src/main/resources/META-INF/version.properties

I guess it might be possible to embed the commit id even into the MANIFEST.MF 
file along with e.g. the timestamp and JDK used.

-- Richard

Reply via email to