[Git][reproducible-builds/reproducible-website][master] Docs/JVM: Flesh out Gradle specifics, add notes about properties + locale/user settings
Chris Lamb (@lamby)
gitlab at salsa.debian.org
Fri Nov 21 18:07:18 UTC 2025
Chris Lamb pushed to branch master at Reproducible Builds / reproducible-website
Commits:
477543d8 by Robert Stupp at 2025-11-21T18:07:13+00:00
Docs/JVM: Flesh out Gradle specifics, add notes about properties + locale/user settings
- - - - -
1 changed file:
- _docs/jvm.md
Changes:
=====================================
_docs/jvm.md
=====================================
@@ -23,6 +23,44 @@ to [Maven Central](https://search.maven.org/) and check that Reproducible Build
Contributions are welcome to write additional [`.buildspec` file](https://github.com/jvm-repo-rebuild/reproducible-central/blob/master/doc/BUILDSPEC.md)
that will be used to rebuild the release and compare against binaries available in Maven Central.
+## Build tool independent considerations
+
+### Properties files
+
+All properties files generated using `java.util.Properties.store()` contain a comment line with the generation timestamp.
+The Java system property `java.properties.date` can be used to set a fixed value used instead of the generation timestamp.
+
+### Character set + locales
+
+When building with Java 17 or older, consider setting `file.encoding=UTF-8`.
+UTF-8 is the [default since Java 18](https://openjdk.org/jeps/400).
+Other system properties to consider depending on your build requirements are
+`user.language`, `user.country`, `user.variant`.
+
+<details><summary>Gradle example (<code>gradle.properties</code> file)</summary>
+
+```properties
+# Consistent character set and locale across all builds.
+systemProp.file.encoding=UTF-8
+systemProp.user.language=en
+systemProp.user.country=US
+systemProp.user.variant=
+```
+</details>
+
+<details><summary>Maven example</summary>
+
+```xml
+<!-- Consistent character set and locale across all builds. -->
+<properties>
+ <file.encoding>UTF-8</file.encoding>
+ <user.language>en</user.language>
+ <user.country>US</user.country>
+ <user.country></user.country>
+</properties>
+```
+</details>
+
## Configuring Build Tools for Reproducible Builds
### Maven
@@ -35,7 +73,30 @@ for more details.
Gradle supports [reproducible archives](https://docs.gradle.org/current/userguide/working_with_files.html#sec:reproducible_archives) as of v3.4.
-Tasks which generate archives, such as ZIPs or JARs, can enforce preserved file timestamps and reproducible file order which fix two of the main sources of non-determinism in JVM artifacts.
+Tasks which generate archives, such as ZIPs, JARs or Tarballs, can enforce preserved file timestamps and reproducible file order which fix two of the main sources of non-determinism in JVM artifacts.
+Consider setting `dirPermissions` and `filePermissions` to adjust environment specific `umask` settings.
+
+<details><summary>Gradle example</summary>
+
+```kotlin
+// This is applied to all Jar, Zip and Tar tasks.
+tasks.withType<AbstractArchiveTask>().configureEach {
+ isPreserveFileTimestamps = false
+ isReproducibleFileOrder = true
+ // consistent directory permissions, ignoring system's umask
+ dirPermissions { unix("755") }
+ // consistent file permissions, ignoring system's umask, retaining the executable permission (either 644 or 755)
+ filePermissions {
+ user.read = true
+ user.write = true
+ group.read = true
+ group.write = false
+ other.read = true
+ other.write = false
+ }
+}
+```
+</details>
### `sbt`
View it on GitLab: https://salsa.debian.org/reproducible-builds/reproducible-website/-/commit/477543d85af6e53dd5e82f25f1992b5c13156db0
--
View it on GitLab: https://salsa.debian.org/reproducible-builds/reproducible-website/-/commit/477543d85af6e53dd5e82f25f1992b5c13156db0
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.reproducible-builds.org/pipermail/rb-commits/attachments/20251121/0ecb909f/attachment.htm>
More information about the rb-commits
mailing list