Enable reproducible builds#153
Conversation
By setting the timestamp of produced files, we enable artifacts to be
bit-for-bit reproducible from one build to another.
Reproducible builds are useful for checking that files were not tampered
with.
Tested by running:
mvn artifact:check-buildplan
mvn clean install
mvn clean artifact:compare
For more information:
- https://reproducible-builds.org/docs/jvm/
- https://maven.apache.org/guides/mini/guide-reproducible-builds.html
|
| </developers> | ||
| <properties> | ||
| <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
| <project.build.outputTimestamp>2024-01-01T00:00:00Z</project.build.outputTimestamp> |
There was a problem hiding this comment.
Not sure we want an explicit time stamp. Would be nice if it was the git commit from https://maven.apache.org/guides/mini/guide-reproducible-builds.html or just the timestamp from the build time.
There was a problem hiding this comment.
The timestamp from the build time makes the build not reproducible, since two builds of the same source code will give two different timestamps.
For the timestamp from the git commit, I don't mind changing the PR, but it will not work if the user downloads ZIP files from GitHub, which a certain number of build system does by default.
There was a problem hiding this comment.
I think getting the timestamp from the git commit, and then if it doesn't exist use a default timestamp makes sense. Otherwise the timestamp will most of the time be nonsensical.
There was a problem hiding this comment.
Sounds good to me! However I'm not sure how to implement it, I'm not a Java person. If you know how, please tell me and I'll update the PR. Else I might have to ask around.
There was a problem hiding this comment.
We could look into this plugin
https://github.com/git-commit-id/git-commit-id-maven-plugin
we don't need to access this info in code or generate a properties file... but simply try to get it as a maven property
you can use any one of these properties |



Hello, and thanks for this project!
This PR enables reproducible builds, which are useful for checking that files were not tampered with.
By setting the timestamp of produced files, we enable artifacts to be bit-for-bit reproducible from one build to another.
Tested by running:
Done with the help of these guides: