Maven JAR Plugin
  1. Maven JAR Plugin
  2. MJAR-62

Build-Jdk in Manifest.mf does not reflect which compiler version actually compiled the classes in the jar

    Details

    • Type: Bug Bug
    • Status: Reopened
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      Manifest.mf does not reflect the version of the compiler that built the jar, but defaults to the version that maven runs under: Build-Jdk: $

      {java.version}

      .
      I believe this makes users uncertain of which compiler was actually used to build the classes.

      1. example-app.zip
        4 kB
        Peter Janssen

        Activity

        Stefan Magnus Landrø created issue -
        Hide
        Olivier Lamy (*$^¨%`£) added a comment -

        Agree in case of forked compilation.
        But currently it's impossible for the jar plugin to know if the javac was forked with using an other JAVA_HOME.
        http://docs.codehaus.org/display/MAVEN/Toolchains will probably help.

        Show
        Olivier Lamy (*$^¨%`£) added a comment - Agree in case of forked compilation. But currently it's impossible for the jar plugin to know if the javac was forked with using an other JAVA_HOME. http://docs.codehaus.org/display/MAVEN/Toolchains will probably help.
        Hide
        Frederic added a comment -

        Is it possible for the jar plugin to support the toolchain features?
        The manifest information (Build-Jdk) would then be correct.

        Show
        Frederic added a comment - Is it possible for the jar plugin to support the toolchain features? The manifest information (Build-Jdk) would then be correct.
        Hide
        Michael Osipov added a comment -

        Please refer to https://cwiki.apache.org/confluence/display/MAVEN/The+Great+JIRA+Cleanup+of+2014 if you're wondering why this issue was closed out.

        Show
        Michael Osipov added a comment - Please refer to https://cwiki.apache.org/confluence/display/MAVEN/The+Great+JIRA+Cleanup+of+2014 if you're wondering why this issue was closed out.
        Michael Osipov made changes -
        Field Original Value New Value
        Resolution Won't Fix [ 2 ]
        Status Open [ 1 ] Closed [ 6 ]
        Mark Thomas made changes -
        Project Import Sun Apr 05 10:31:03 UTC 2015 [ 1428229863560 ]
        Mark Thomas made changes -
        Workflow jira [ 12721956 ] Default workflow, editable Closed status [ 12759556 ]
        Mark Thomas made changes -
        Project Import Mon Apr 06 00:05:23 UTC 2015 [ 1428278723217 ]
        Mark Thomas made changes -
        Workflow jira [ 12959512 ] Default workflow, editable Closed status [ 12996417 ]
        Hide
        Peter Janssen added a comment -

        I agree with Stefan that this is not expected behaviour. I supplied an example project (requiring a JDK17 profile in the settings.xml). Can we reconsider the close?

        Show
        Peter Janssen added a comment - I agree with Stefan that this is not expected behaviour. I supplied an example project (requiring a JDK17 profile in the settings.xml). Can we reconsider the close?
        Peter Janssen made changes -
        Attachment example-app.zip [ 12757010 ]
        Hide
        Michael Osipov added a comment -

        Reopening per request.

        Show
        Michael Osipov added a comment - Reopening per request.
        Michael Osipov made changes -
        Resolution Won't Fix [ 2 ]
        Status Closed [ 6 ] Reopened [ 4 ]
        Hide
        Nathan Revo added a comment -

        I just spent 3 days trying to work around this problem. Lots of frustration involved, and I want to know why Build-Jdk is defined inside maven-archiver.

        Also, why doesn't toolchains expose useful properties by default. Version, home and architecture seem important to me.

        Our solution is to create a custom plugin that will call the javac binary with the -version argument and extract the version. This value will be set as a maven property, which should be usable inside the pom.

        Show
        Nathan Revo added a comment - I just spent 3 days trying to work around this problem. Lots of frustration involved, and I want to know why Build-Jdk is defined inside maven-archiver. Also, why doesn't toolchains expose useful properties by default. Version, home and architecture seem important to me. Our solution is to create a custom plugin that will call the javac binary with the -version argument and extract the version. This value will be set as a maven property, which should be usable inside the pom.
        Hide
        Michael Osipov added a comment -

        Nathan, do you think you can provide some valueable patch because toolchains support has been improved lately?

        Show
        Michael Osipov added a comment - Nathan, do you think you can provide some valueable patch because toolchains support has been improved lately?
        Hide
        Nathan Revo added a comment -

        Michael OsipovI will look into creating a patch. What maven version were you referring to in your comment? Also, it felt like my custom plugin would turn into a messy patch as I was calling the "javac" command directly and parsing the output.

        Here are some questions I have that should be addressed before a meaningful patch can be created:

        • How are these options handled for for compiling code and/or making archives (jar files). What is the precedence?
        • - runtime jdk. assuming it is a JDK and not just a JRE use javac/jar binaries from here?
        • - toolchains.xml, is it present, is it configured properly, use javac/jar binaries from here?
        • - compiler executable, do I use the value from the maven compiler plugin, do I provide one in the archiver plugin?
        • - java.home environment variable, is this where javac or jar are executed from?
        • which plugin will this be added to? archiver, compiler, jar?
        Show
        Nathan Revo added a comment - Michael Osipov I will look into creating a patch. What maven version were you referring to in your comment? Also, it felt like my custom plugin would turn into a messy patch as I was calling the "javac" command directly and parsing the output. Here are some questions I have that should be addressed before a meaningful patch can be created: How are these options handled for for compiling code and/or making archives (jar files). What is the precedence? - runtime jdk. assuming it is a JDK and not just a JRE use javac/jar binaries from here? - toolchains.xml, is it present, is it configured properly, use javac/jar binaries from here? - compiler executable, do I use the value from the maven compiler plugin, do I provide one in the archiver plugin? - java.home environment variable, is this where javac or jar are executed from? which plugin will this be added to? archiver, compiler, jar?
        Hide
        Michael Osipov added a comment -

        Maven version 3.3.1 has improved toolchains support. I have a look at your questions later.

        Show
        Michael Osipov added a comment - Maven version 3.3.1 has improved toolchains support. I have a look at your questions later.
        Michael Osipov made changes -
        Comment [ Maven version [3.3.1|https://issues.apache.org/jira/secure/ReleaseNote.jspa?projectId=12316922&version=12330193] has improved toolchains support. I have a look at your questions later. ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Closed Closed
        2941d 9h 22m 1 Michael Osipov 25/Nov/14 14:48
        Closed Closed Reopened Reopened
        295d 21h 1m 1 Michael Osipov 17/Sep/15 11:50

          People

          • Assignee:
            Unassigned
            Reporter:
            Stefan Magnus Landrø
          • Votes:
            5 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

            • Created:
              Updated:

              Development