File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
src/main/java/org/apache/maven/plugins/source Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -284,11 +284,16 @@ protected void packageSources( List<MavenProject> theProjects )
284
284
285
285
if ( sourceDateEpoch != 0 )
286
286
{
287
+ // configure for Reproducible Builds based on source date epoch value
287
288
JarArchiver j = archiver .getArchiver ();
289
+
290
+ // 1. force timestamp of zip entries (at zip storage level, that ignores timezone)
288
291
Calendar cal = Calendar .getInstance ();
289
292
long zipTime =
290
293
1000L * sourceDateEpoch - ( cal .get ( Calendar .ZONE_OFFSET ) + cal .get ( Calendar .DST_OFFSET ) );
291
294
j .setLastModifiedDate ( new Date ( zipTime ) );
295
+
296
+ // 2. sort filenames in each directory when scanning filesystem
292
297
j .setFilenameComparator ( new Comparator <String >()
293
298
{
294
299
@ Override
@@ -297,8 +302,10 @@ public int compare( String s1, String s2 )
297
302
return s1 .compareTo ( s2 );
298
303
}
299
304
} );
300
- j .setFileMode ( Archiver .DEFAULT_FILE_MODE ); // notice: overrides execute bit on Unix
301
- // (that is already ignored on Windows)
305
+
306
+ // 3. ignore file/directory mode from filesystem, since they may vary based on local user umask
307
+ // notice: this overrides execute bit on Unix (that is already ignored on Windows)
308
+ j .setFileMode ( Archiver .DEFAULT_FILE_MODE );
302
309
j .setDirectoryMode ( Archiver .DEFAULT_DIR_MODE );
303
310
}
304
311
You can’t perform that action at this time.
0 commit comments