-
Notifications
You must be signed in to change notification settings - Fork 41.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RepackageMojo doesn't support 1 digit numerical values for project.build.outputTimestamp #37438
RepackageMojo doesn't support 1 digit numerical values for project.build.outputTimestamp #37438
Conversation
I can confirm @nielsbasjes finding that setting |
I went through the build logs to see why it failed. I found this.
|
@nielsbasjes there's no connection. It's an unfortunate intermittent failure that we, as far as I can recall, have only seen on GitHub actions. Please ignore it for now. We will build your changes locally prior to merging them. |
// Maven ignores a single-character timestamp as it is "useful to override a full | ||
// value during pom inheritance" | ||
if (this.outputTimestamp == null || this.outputTimestamp.length() < 2) { | ||
// Maven ignores a single-character non-digit timestamp as it is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It feels to me that the right fix would be to declare a dependency on the maven-archiver artifact and call MavenArchiver#parseBuildOutputTimestamp(String outputTimestamp)
to get the exact same behavior (and then parse the result into a FileTime object). This is still incomplete and may break in other ways.
See https://github.com/nielsbasjes/maven-archiver/blob/master/src/main/java/org/apache/maven/archiver/MavenArchiver.java#L768C37-L801 for the actual implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. We'll polish the PR when we merge it and then use the same code as your linked Mojo.
When merging this, polish the contribution so that the parsing of the timestamp matches the implementation in https://github.com/nielsbasjes/maven-archiver/blob/master/src/main/java/org/apache/maven/archiver/MavenArchiver.java#L768C37-L801 A dependency for just one method feels unjustified. |
@mhalbritter Would you like me to update the pull request in this way? Or are you going to pick this up? |
then you just set yourself up for another breakage some time in the future. The maven-archiver artifact is available anyway, declaring a dependency is not a big deal and it allows you to write less code but call code that is maintained by the maven project. Not sure why you consider this unjustified. Anyway, your call. |
If you like, you can do it, i'd be happy. If you don't find the time, I'll do it on the merge. |
Working on it. |
…ild.outputTimestamp
I have now copied part of the maven archiver code as I understood this is what you wanted (instead of adding the maven-archiver dependency). |
Thanks a lot! |
For a build to be reproducible the
project.build.outputTimestamp
needs to be set to a valid value for thespring-boot-maven-plugin
.This can be either a number (indicating the epoch seconds) or an ISO 8601 timestamp.
These example values all work as expected (plugin version 3.1.3):
This merge request fixes the edge case of having a single character numerical timestamp which has been implemented differently from what Maven does.
Maven accepts a '0' as a valid timestamp.
See for example https://github.com/apache/maven-archiver/blob/master/src/main/java/org/apache/maven/archiver/MavenArchiver.java#L762
The Spring Boot maven plugin currently sees the '0' as a null instead (i.e. no timestamp set instead of epoch=0).