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

Michael Osipov commented on MJAR-275:
-------------------------------------

For the sake of completeness:

Java 14:
{noformat}
$ JAVA_VERSION=14 javap -v  with-moduleinfo/target/classes/module-info.class
Classfile 
/var/osipovmi/Projekte/MCOMPILER-439/with-moduleinfo/target/classes/module-info.class
  Last modified 27.10.2020; size 217 bytes
  SHA-256 checksum 
3568d28550acaf940a86055217f3d9a9ccae9751d14f500be7bde84644827bd4
  Compiled from "module-info.java"
module me.a248.mcompiler439@0.1.0-SNAPSHOT
  minor version: 0
  major version: 55
  flags: (0x8000) ACC_MODULE
  this_class: #1                          // "module-info"
  super_class: #0
  interfaces: 0, fields: 0, methods: 0, attributes: 2
Constant pool:
   #1 = Class              #2             // "module-info"
   #2 = Utf8               module-info
   #3 = Utf8               SourceFile
   #4 = Utf8               module-info.java
   #5 = Utf8               Module
   #6 = Module             #7             // "me.a248.mcompiler439"
   #7 = Utf8               me.a248.mcompiler439
   #8 = Utf8               0.1.0-SNAPSHOT
   #9 = Module             #10            // "java.base"
  #10 = Utf8               java.base
  #11 = Utf8               14.0.2
  #12 = Package            #13            // me/a248/mcompiler439
  #13 = Utf8               me/a248/mcompiler439
{
}
SourceFile: "module-info.java"
Module:
  #6,0                                    // "me.a248.mcompiler439"
  #8                                      // 0.1.0-SNAPSHOT
  1                                       // requires
    #9,8000                                 // "java.base" ACC_MANDATED
    #11                                     // 14.0.2
  1                                       // exports
    #12,0                                   // me/a248/mcompiler439
  0                                       // opens
  0                                       // uses
  0                                       // provides
{noformat}

Java 11:
{noformat}
$ JAVA_VERSION=11 javap -v  with-moduleinfo/target/classes/module-info.class
Classfile 
/var/osipovmi/Projekte/MCOMPILER-439/with-moduleinfo/target/classes/module-info.class
  Last modified 27.10.2020; size 217 bytes
  MD5 checksum ab00cdf6f4aa9a49a0059c56088b1839
  Compiled from "module-info.java"
module me.a248.mcompiler439@0.1.0-SNAPSHOT
  minor version: 0
  major version: 55
  flags: (0x8000) ACC_MODULE
  this_class: #1                          // "module-info"
  super_class: #0
  interfaces: 0, fields: 0, methods: 0, attributes: 2
Constant pool:
   #1 = Class              #10            // "module-info"
   #2 = Utf8               SourceFile
   #3 = Utf8               module-info.java
   #4 = Utf8               Module
   #5 = Module             #11            // "me.a248.mcompiler439"
   #6 = Utf8               0.1.0-SNAPSHOT
   #7 = Module             #12            // "java.base"
   #8 = Utf8               11.0.8
   #9 = Package            #13            // me/a248/mcompiler439
  #10 = Utf8               module-info
  #11 = Utf8               me.a248.mcompiler439
  #12 = Utf8               java.base
  #13 = Utf8               me/a248/mcompiler439
{
}
SourceFile: "module-info.java"
Module:
  #5,0                                    // "me.a248.mcompiler439"
  #6                                      // 0.1.0-SNAPSHOT
  1                                       // requires
    #7,8000                                 // "java.base" ACC_MANDATED
    #8                                      // 11.0.8
  1                                       // exports
    #9,0                                    // me/a248/mcompiler439
  0                                       // opens
  0                                       // uses
  0                                       // provides
{noformat}

> 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
>         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/MCOMPILER-439]
> (Source code is also provided as an attachment)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to