Skip to content

Commit e49c9df

Browse files
jorsolslawekjaranowski
authored andcommitted
[MSOURCES-132] - Update Maven Archiver to 3.6.0
Signed-off-by: Jorge Solórzano <[email protected]>
1 parent 7c9e681 commit e49c9df

File tree

3 files changed

+18
-5
lines changed

3 files changed

+18
-5
lines changed

pom.xml

+6-1
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,18 @@ under the License.
120120
<dependency>
121121
<groupId>org.apache.maven</groupId>
122122
<artifactId>maven-archiver</artifactId>
123-
<version>3.5.0</version>
123+
<version>3.6.0</version>
124124
</dependency>
125125
<dependency>
126126
<groupId>org.codehaus.plexus</groupId>
127127
<artifactId>plexus-utils</artifactId>
128128
<version>3.4.2</version>
129129
</dependency>
130+
<dependency>
131+
<groupId>commons-io</groupId>
132+
<artifactId>commons-io</artifactId>
133+
<version>2.11.0</version>
134+
</dependency>
130135

131136
<dependency>
132137
<groupId>org.apache.maven.plugin-testing</groupId>

src/it/reproducible/verify.groovy

+11-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
* under the License.
1919
*/
2020

21+
import java.nio.file.attribute.FileTime;
22+
import java.time.Instant;
2123
import org.apache.commons.compress.archivers.zip.*;
2224

2325
File deployDir = new File( basedir, 'target/repo/org/apache/maven/its/reproducible/1.0' )
@@ -63,13 +65,21 @@ long javaToDosTime( Date d )
6365
d.getSeconds() >> 1;
6466
}
6567

68+
// Normalize to UTC
69+
long millis = Instant.parse( "2019-08-21T18:28:52Z" ).toEpochMilli();
70+
Calendar cal = Calendar.getInstance();
71+
cal.setTimeInMillis( millis );
72+
millis = millis - ( cal.get( Calendar.ZONE_OFFSET ) + cal.get( Calendar.DST_OFFSET ) );
73+
FileTime timestamp = FileTime.fromMillis( millis );
74+
6675
for ( ZipArchiveEntry zae : zipFile.getEntries() )
6776
{
6877
r.append( sprintf( "%d %4d (%3d) %8x %d %<tF %<tT %<tz %d %6o %s %s; %s\n", zae.getMethod(), zae.getSize(), zae.getCompressedSize(), zae.getCrc(), zae.getTime(), javaToDosTime( zae.getLastModifiedDate() ), zae.getUnixMode(), zae.getName(), ( zae.getComment() == null ) ? '-' : zae.getComment(), describeExtra( zae.getExtraFields() ) ) )
78+
assert timestamp.equals( zae.getLastModifiedTime() );
6979
}
7080
zipFile.close();
7181

7282
String buf = r.toString()
7383
println buf
7484

75-
assert buf.startsWith( "reproducible-1.0-sources.jar sha1 = 3a3687b063cfc164fbbccd1b9573b4232f540e8a" )
85+
assert buf.startsWith( "reproducible-1.0-sources.jar sha1 = f159379802c1f0dc1083af21352286b09d364519" )

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

+1-3
Original file line numberDiff line numberDiff line change
@@ -432,17 +432,15 @@ protected MavenArchiver createArchiver()
432432
archiver.setCreatedBy( "Maven Source Plugin", "org.apache.maven.plugins", "maven-source-plugin" );
433433
archiver.setBuildJdkSpecDefaultEntry( false );
434434

435-
436435
// configure for Reproducible Builds based on outputTimestamp value
437-
archiver.configureReproducible( outputTimestamp );
436+
archiver.configureReproducibleBuild( outputTimestamp );
438437

439438
if ( project.getBuild() != null )
440439
{
441440
List<Resource> resources = project.getBuild().getResources();
442441

443442
for ( Resource r : resources )
444443
{
445-
446444
if ( r.getDirectory().endsWith( "maven-shared-archive-resources" ) )
447445
{
448446
addDirectory( archiver.getArchiver(), new File( r.getDirectory() ), getCombinedIncludes( null ),

0 commit comments

Comments
 (0)