Hi buddy,
First, I use the version 2.7.18 & JDK 8. when I repackage a microservice jar, I found the modification timestamp of one dependent jar is always remain the same time, while it's creation timestamp had been updated. It looks like the plugin uses the timestamp of the first file in the jar as the modification timestamp for the jar. This issue confused me. I do think there's a bug here.
Best wishes,
Jingde Wang
Comment From: wilkinsona
First, I use the version 2.7.18 & JDK 8.
Spring Boot 2.7.x is no longer supported. Please upgrade to Spring Boot 3.2.x or later.
I found the modification timestamp of one dependent jar is always remain the same time, while it's creation timestamp had been updated. It looks like the plugin uses the timestamp of the first file in the jar as the modification timestamp for the jar
Sorry, I don't think I understand your description of the problem. Spring Boot's Maven plugin will use project.build.outputTimestamp to set the last-modified time of entries in the repackaged jar but I'm not sure that you've set that property.
If you would like us to spend some more time investigating, please spend some time providing a complete yet minimal sample that reproduces the problem with Spring Boot 3.2.x or later. You can share it with us by pushing it to a separate repository on GitHub or by zipping it up and attaching it to this issue.
Comment From: Jingde2023
Yes, everything worked fine when I added the following configuration line in the POM file.
<outputTimestamp>${maven.build.timestamp}</outputTimestamp>
By the way, why isn't this the default option? The default option now is confusing. Anyway, thanks a lot!
Comment From: philwebb
By the way, why isn't this the default option?
We follow standard the Maven practices, specifically mirroring what the standard jar plugin does. See https://maven.apache.org/guides/mini/guide-reproducible-builds.html