On 9/25/24 7:23 AM, Jorge Solórzano wrote:
* Using the SCM last commit date is a bad choice, not everyone will use SCM
or the source code could be downloaded without scm information (eg.: Source
Code download links from GitHub), so this is a -1 for me.
That makes sense, but in general, I always set the date like this:
SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)
export SOURCE_DATE_EPOCH
I pass that to Maven with:
<project.build.outputTimestamp>
${env.SOURCE_DATE_EPOCH}
</project.build.outputTimestamp>
* This leaves us with the fixed value by default, the current value (in the
PR) is 2001-01-01T00:00:00Z.... this is a good approach, but my personal
preference is to set it to 1980-01-01T00:00:02Z, the minimal date allowed.
Right! See my comment below on the pull request that added this feature
to the 'jar' and 'jmod' tools in the JDK:
https://github.com/openjdk/jdk/pull/6481#issuecomment-984220137
Just for reference, at the time of my comment, Debian added 12 hours 1
minute to the first second of 1980 for their default value
(1980-01-01T12:01:00Z), while Gradle skipped to the next month
(1980-02-01T00:00:00Z).
The main thing is to avoid 1980-01-01T00:00:00Z, 1980-01-01T00:00:01Z,
and any earlier instant.
There should be a way to opt out of this and get the previous behavior for
those that don't what this.
How about just using SOURCE_DATE_EPOCH directly when defined? I guess
that's more opt-in than opt-out, but it would at least let me avoid
having to define 'project.build.outputTimestamp' in all my projects.
John
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org