Skip to content

Commit 3f5f97f

Browse files
committed
MSOURCES-120 moved reusable code to plexus-archiver PR #121
codehaus-plexus/plexus-archiver#121
1 parent 852c203 commit 3f5f97f

File tree

1 file changed

+1
-25
lines changed

1 file changed

+1
-25
lines changed

src/main/java/org/apache/maven/plugins/source/AbstractSourceJarMojo.java

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@
2323
import java.io.IOException;
2424
import java.util.ArrayList;
2525
import java.util.Arrays;
26-
import java.util.Calendar;
27-
import java.util.Comparator;
28-
import java.util.Date;
2926
import java.util.List;
3027

3128
import org.apache.maven.archiver.MavenArchiveConfiguration;
@@ -285,28 +282,7 @@ protected void packageSources( List<MavenProject> theProjects )
285282
if ( sourceDateEpoch != 0 )
286283
{
287284
// configure for Reproducible Builds based on source date epoch value
288-
JarArchiver j = archiver.getArchiver();
289-
290-
// 1. force timestamp of zip entries (at zip storage level, that ignores timezone)
291-
Calendar cal = Calendar.getInstance();
292-
long zipTime =
293-
1000L * sourceDateEpoch - ( cal.get( Calendar.ZONE_OFFSET ) + cal.get( Calendar.DST_OFFSET ) );
294-
j.setLastModifiedDate( new Date( zipTime ) );
295-
296-
// 2. sort filenames in each directory when scanning filesystem
297-
j.setFilenameComparator( new Comparator<String>()
298-
{
299-
@Override
300-
public int compare( String s1, String s2 )
301-
{
302-
return s1.compareTo( s2 );
303-
}
304-
} );
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 );
309-
j.setDirectoryMode( Archiver.DEFAULT_DIR_MODE );
285+
archiver.getArchiver().configureReproducible( sourceDateEpoch );
310286
}
311287

312288
for ( MavenProject pItem : theProjects )

0 commit comments

Comments
 (0)