[ 
https://issues.apache.org/jira/browse/MJAR-275?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17552063#comment-17552063
 ] 

Jorge Solórzano commented on MJAR-275:
--------------------------------------

Please note that as Michael points out there are two issues here:
 # Modification of timestamps
 # Incorporation of patch JDK version information

The fix in plexus-archiver #205 only handles the first one, the timestamps, but 
when you use the same version of the JDK to compile the module declaration it 
adds the JDK patch version to the module descriptor making it non reproducible 
(unless you use the exact same JDK version).

Anyway, to overcome this limitation you can build the module descriptor 
targeting Java 9 using a newer JDK (e.g. using JDK 11 to compile a 
module-info.java with --release 9).

> outputTimestamp not applied to module-info; breaks reproducible builds
> ----------------------------------------------------------------------
>
>                 Key: MJAR-275
>                 URL: https://issues.apache.org/jira/browse/MJAR-275
>             Project: Maven JAR Plugin
>          Issue Type: Bug
>    Affects Versions: 3.2.0
>         Environment: Mac OS X 10.14.6
> JDK 15 (build 15+36)
> JDK 11 (build 11.0.8+10)
>            Reporter: Anand Beh
>            Priority: Minor
>             Fix For: 3.3.0
>
>         Attachments: MCOMPILER-439.zip, Screenshot 2020-10-25 at 2.35.59 
> PM.png
>
>
> Setting {{project.build.outputTimestamp}} to a fixed value allows creating 
> reproducible builds per this guide: 
> [https://maven.apache.org/guides/mini/guide-reproducible-builds.html 
> |https://maven.apache.org/guides/mini/guide-reproducible-builds.html]However, 
> if one adds a module-info file to the project, reproducible builds break.
> This is caused by module-info.class using the latest timestamp and not 
> {{project.build.outputTimestamp}}. I was able to identify the problem using 
> diffoscope: [https://diffoscope.org/.|https://diffoscope.org/] With it I 
> determined the timestamp across 2 builds was constant for all but the 
> module-info.class:
>  
> {code:java}
>   -rw----     2.0 fat      862 bl defN 20-Oct-17 00:40 
> space/arim/libertybans/api/select/SelectionOrder.class
> │  -rw----     2.0 fat     1113 bl defN 20-Oct-17 00:40 
> space/arim/libertybans/api/select/SelectionOrderBuilder.class
> │  -rw----     2.0 fat     2285 bl defN 20-Oct-17 00:40 
> META-INF/maven/space.arim.libertybans/bans-api/pom.xml
> │  -rw----     2.0 fat       74 bl defN 20-Oct-17 00:40 
> META-INF/maven/space.arim.libertybans/bans-api/pom.properties
> │ --rw----     2.0 fat      557 bl defN 20-Oct-25 12:39 module-info.class
> │ +-rw----     2.0 fat      557 bl defN 20-Oct-25 12:41 module-info.class
> {code}
>  
> Note the + and - which are diffoscope's way of indicating the difference 
> between the .jar files. Here the {{project.build.outputTimestamp}} is on 17 
> October. As shown, module-info has a "rebellious" timestamp.
>  
> *EDIT:*
> Example project to reproduce the bug:
> [https://github.com/A248/MJAR-275|https://github.com/A248/MCOMPILER-439] 
> (Renamed from [https://github.com/A248/MCOMPILER-439])
> Source code is also provided as an attachment below



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to