spring-boot
spring-boot copied to clipboard
Change dateformat for git-commit-id-maven-plugin from `yyyy-MM-dd'T'HHH:mm:ssZ` RFC 822 to `yyyy-MM-dd'T'HH:mm:ssXXX` ISO 8601
Related to https://github.com/git-commit-id/git-commit-id-maven-plugin/issues/674.
This change is required to make the times produced by the git-commit-id-maven-plugin usable for Maven's reproducible builds.
Timestamp for reproducible output archive entries must either formatted as ISO 8601 yyyy-MM-dd'T'HH:mm:ssXXX or as an int representing seconds since the epoch
Example usage might be E.g.
<properties>
<project.build.outputTimestamp>${git.commit.time}</project.build.outputTimestamp>
</properties>
Isn't yyyy-MM-dd'T'HHH:mm:ssZ (2024-02-16T19:32:16Z) in fact conforms ISO 8601?
If the time is in UTC, add a Z directly after the time without a space. Z is the zone designator for the zero UTC offset. "09:30 UTC" is therefore represented as "09:30Z" or "T0930Z". "14:45:15 UTC" would be "14:45:15Z" or "T144515Z".
That's what the Maven docs are using too on the page you linked above:
<project.build.outputTimestamp>2023-01-01T00:00:00Z</project.build.outputTimestamp>
Isn't
yyyy-MM-dd'T'HHH:mm:ssZ(2024-02-16T19:32:16Z) in fact conforms ISO 8601?If the time is in UTC, add a Z directly after the time without a space. Z is the zone designator for the zero UTC offset. "09:30 UTC" is therefore represented as "09:30Z" or "T0930Z". "14:45:15 UTC" would be "14:45:15Z" or "T144515Z".
That's what the Maven docs are using too on the page you linked above:
<project.build.outputTimestamp>2023-01-01T00:00:00Z</project.build.outputTimestamp>
No, you are confusing to yyyy-MM-dd'T'HH:mm:ss'Z' with yyyy-MM-dd'T'HHH:mm:ssZ.
Oops, indeed, I meant Z in the output (UTC + ISO 8601), I missed that in the diff too. XXX does that if the time is in UTC but I'm not sure if that is guaranteed (if it isn't maybe that should be the concern of another issue). Btw, I think you also meant HH instead of HHH.
So, git.commit.time=2024-02-19T10:18:10+0100 (RFC 822) is bad, and git.commit.time=2024-02-19T10:18:10+01:00 (ISO 8601) is good? The latter can be parsed by Instant.parse, too.
So,
git.commit.time=2024-02-19T10:18:10+0100is bad, andgit.commit.time=2024-02-19T10:18:10+01:00is good? The latter can be parsed byInstant.parse, too.
Correct.
Note to myself: Check what the Gradle plugin does.
@TheSnoozer @mhalbritter Please change the title because ISO 8601 is not aware of any timezones, but offsets only.
Thank you very much and congratulations on your first contribution :tada:!
Great, thanks for getting this integrated :-)
This has been superseded by https://github.com/spring-projects/spring-boot/issues/40015 as we can now use the plugin's default.