Topic
  • 6 replies
  • Latest Post - ‏2013-06-14T15:18:44Z by rsanchezh
ivyho
ivyho
67 Posts

Pinned topic Cannot change JDK 1.7 in Manifest.MF for Maven project to java compiler specified jdk 1.6 version in RAD 85.x

‏2013-06-11T19:00:22Z |

Using RAD 851 which ships a jdk 1.7 by default with the product.

I have imported a maven project into RAD 851 with target runtime websphere application server 7  and want to use jdk 1.6 to compile and package the project.

In the windows->Preferences->Java ->Compiler.

I have set the Compiler Compliance level to 1.6.

In the installed JRE, I am using websphere application server JRE which is 1.6 as well.

But after I build the maven project -  I found that the MAIFEST.MF 

It is still showing JDK 1.7.

Manifest-Version: 1.0
Build-Jdk: 1.7.0
Built-By: Administrator
Created-By: Maven Integration for Eclipse

 

Expected it to be:

Manifest-Version: 1.0

Build-Jdk: 1.6.0
Built-By: Administrator
Created-By: Maven Integration for Eclipse

Is there a way to workaround this issue and forces the build to pick up the JDK 1.6 instead?

 

 

Updated on 2013-06-12T17:12:32Z at 2013-06-12T17:12:32Z by ivyho
  • rsanchezh
    rsanchezh
    47 Posts

    Re: Cannot change JDK 1.7 in Manifest.MF for Maven project to java compiler specified jdk 1.6 version in RAD 85.x

    ‏2013-06-12T16:59:30Z  

    Hi,
    Looks like this is a limitation in Maven (more exactly, the maven jar plugin), as reported in this bug https://jira.codehaus.org/browse/MJAR-62?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

    According to that bug, the maven jar plugin sets the Build-Jdk entry in the MANIFEST.MF to be the version of the JVM used to run Maven. The Maven integration for eclipse tools generates the MANIFEST.MF using, under the covers, the maven jar plugin, therefore, the Build-Jdk is set to the version of the JVM that runs the Maven tools, which is the same in which RAD is running, which is version 1.7. That is the reason why, when you build a Maven project in RAD, you will see  that the generated manifest will have a content similar to this:

    Manifest-Version: 1.0
    Build-Jdk: 1.7.0
    Built-By: Administrator
    Created-By: Maven Integration for Eclipse


    As a work around to this limitation, you could try this: Right click on the project and select Run as > Maven build ..., in the goal field type in package, and in the JRE tab, select the JDK or JRE you want to use to run Maven and to compile the code, which I guess would be the WebSphere application server 7 JRE. This will generate a jar (or the archive appropriate to the packaging you are using), and the maniifest should have the correct Build-Jdk entry.

    By doing this, we are starting Maven in a different JVM (the one specified in the jre tab) and that JVM is used to run maven, compile the project (according to the java version specified in the pom), and package it, and the manifest will have that version of JDK used to run maven.

    Having said that, I think having the wrong Build-Jdk in the MANIFEST.MF generated by RAD should not affect during development, given that this fields apparently is used to identify which java version was used to compile classes. Have you identified a problem caused by having the Build-Jdk value set to 1.7.0 instead of 1.6.0?

     

  • rsanchezh
    rsanchezh
    47 Posts

    Re: Cannot change JDK 1.7 in Manifest.MF for Maven project to java compiler specified jdk 1.6 version in RAD 85.x

    ‏2013-06-12T17:00:20Z  

    Hi,
    Looks like this is a limitation in Maven (more exactly, the maven jar plugin), as reported in this bug https://jira.codehaus.org/browse/MJAR-62?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

    According to that bug, the maven jar plugin sets the Build-Jdk entry in the MANIFEST.MF to be the version of the JVM used to run Maven. The Maven integration for eclipse tools generates the MANIFEST.MF using, under the covers, the maven jar plugin, therefore, the Build-Jdk is set to the version of the JVM that runs the Maven tools, which is the same in which RAD is running, which is version 1.7. That is the reason why, when you build a Maven project in RAD, you will see  that the generated manifest will have a content similar to this:

    Manifest-Version: 1.0
    Build-Jdk: 1.7.0
    Built-By: Administrator
    Created-By: Maven Integration for Eclipse


    As a work around to this limitation, you could try this: Right click on the project and select Run as > Maven build ..., in the goal field type in package, and in the JRE tab, select the JDK or JRE you want to use to run Maven and to compile the code, which I guess would be the WebSphere application server 7 JRE. This will generate a jar (or the archive appropriate to the packaging you are using), and the maniifest should have the correct Build-Jdk entry.

    By doing this, we are starting Maven in a different JVM (the one specified in the jre tab) and that JVM is used to run maven, compile the project (according to the java version specified in the pom), and package it, and the manifest will have that version of JDK used to run maven.

    Having said that, I think having the wrong Build-Jdk in the MANIFEST.MF generated by RAD should not affect during development, given that this fields apparently is used to identify which java version was used to compile classes. Have you identified a problem caused by having the Build-Jdk value set to 1.7.0 instead of 1.6.0?

     

  • rsanchezh
    rsanchezh
    47 Posts

    Re: Cannot change JDK 1.7 in Manifest.MF for Maven project to java compiler specified jdk 1.6 version in RAD 85.x

    ‏2013-06-12T17:00:54Z  

    Hi,
    Looks like this is a limitation in Maven (more exactly, the maven jar plugin), as reported in this bug https://jira.codehaus.org/browse/MJAR-62?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

    According to that bug, the maven jar plugin sets the Build-Jdk entry in the MANIFEST.MF to be the version of the JVM used to run Maven. The Maven integration for eclipse tools generates the MANIFEST.MF using, under the covers, the maven jar plugin, therefore, the Build-Jdk is set to the version of the JVM that runs the Maven tools, which is the same in which RAD is running, which is version 1.7. That is the reason why, when you build a Maven project in RAD, you will see  that the generated manifest will have a content similar to this:

    Manifest-Version: 1.0
    Build-Jdk: 1.7.0
    Built-By: Administrator
    Created-By: Maven Integration for Eclipse


    As a work around to this limitation, you could try this: Right click on the project and select Run as > Maven build ..., in the goal field type in package, and in the JRE tab, select the JDK or JRE you want to use to run Maven and to compile the code, which I guess would be the WebSphere application server 7 JRE. This will generate a jar (or the archive appropriate to the packaging you are using), and the maniifest should have the correct Build-Jdk entry.

    By doing this, we are starting Maven in a different JVM (the one specified in the jre tab) and that JVM is used to run maven, compile the project (according to the java version specified in the pom), and package it, and the manifest will have that version of JDK used to run maven.

    Having said that, I think having the wrong Build-Jdk in the MANIFEST.MF generated by RAD should not affect during development, given that this fields apparently is used to identify which java version was used to compile classes. Have you identified a problem caused by having the Build-Jdk value set to 1.7.0 instead of 1.6.0?

     

  • ivyho
    ivyho
    67 Posts

    Re: Cannot change JDK 1.7 in Manifest.MF for Maven project to java compiler specified jdk 1.6 version in RAD 85.x

    ‏2013-06-12T17:19:01Z  
    • rsanchezh
    • ‏2013-06-12T17:00:54Z

    Hi,
    Looks like this is a limitation in Maven (more exactly, the maven jar plugin), as reported in this bug https://jira.codehaus.org/browse/MJAR-62?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

    According to that bug, the maven jar plugin sets the Build-Jdk entry in the MANIFEST.MF to be the version of the JVM used to run Maven. The Maven integration for eclipse tools generates the MANIFEST.MF using, under the covers, the maven jar plugin, therefore, the Build-Jdk is set to the version of the JVM that runs the Maven tools, which is the same in which RAD is running, which is version 1.7. That is the reason why, when you build a Maven project in RAD, you will see  that the generated manifest will have a content similar to this:

    Manifest-Version: 1.0
    Build-Jdk: 1.7.0
    Built-By: Administrator
    Created-By: Maven Integration for Eclipse


    As a work around to this limitation, you could try this: Right click on the project and select Run as > Maven build ..., in the goal field type in package, and in the JRE tab, select the JDK or JRE you want to use to run Maven and to compile the code, which I guess would be the WebSphere application server 7 JRE. This will generate a jar (or the archive appropriate to the packaging you are using), and the maniifest should have the correct Build-Jdk entry.

    By doing this, we are starting Maven in a different JVM (the one specified in the jre tab) and that JVM is used to run maven, compile the project (according to the java version specified in the pom), and package it, and the manifest will have that version of JDK used to run maven.

    Having said that, I think having the wrong Build-Jdk in the MANIFEST.MF generated by RAD should not affect during development, given that this fields apparently is used to identify which java version was used to compile classes. Have you identified a problem caused by having the Build-Jdk value set to 1.7.0 instead of 1.6.0?

     

    So far I am not aware if any issue  yet but it is just a bit  confusing. At the first glance, you will think that oh, how come it is still JDK 1.7 eventhough we specified JDK 1.6.

    However ,the workaround is working  - with run as->Maven Build     and I specify websphee application Server 7 JRE (which is JDK 1.6

    The MAINFEST.MF generated  inside the packaged jar has the correct JRE version, which is JDK 1.6

    But we will need to unzip the generated jar to check which JDK version the code is actually compiled with and packaged in the jar.

  • ivyho
    ivyho
    67 Posts

    Re: Cannot change JDK 1.7 in Manifest.MF for Maven project to java compiler specified jdk 1.6 version in RAD 85.x

    ‏2013-06-12T17:30:20Z  
    • rsanchezh
    • ‏2013-06-12T16:59:30Z

    Hi,
    Looks like this is a limitation in Maven (more exactly, the maven jar plugin), as reported in this bug https://jira.codehaus.org/browse/MJAR-62?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

    According to that bug, the maven jar plugin sets the Build-Jdk entry in the MANIFEST.MF to be the version of the JVM used to run Maven. The Maven integration for eclipse tools generates the MANIFEST.MF using, under the covers, the maven jar plugin, therefore, the Build-Jdk is set to the version of the JVM that runs the Maven tools, which is the same in which RAD is running, which is version 1.7. That is the reason why, when you build a Maven project in RAD, you will see  that the generated manifest will have a content similar to this:

    Manifest-Version: 1.0
    Build-Jdk: 1.7.0
    Built-By: Administrator
    Created-By: Maven Integration for Eclipse


    As a work around to this limitation, you could try this: Right click on the project and select Run as > Maven build ..., in the goal field type in package, and in the JRE tab, select the JDK or JRE you want to use to run Maven and to compile the code, which I guess would be the WebSphere application server 7 JRE. This will generate a jar (or the archive appropriate to the packaging you are using), and the maniifest should have the correct Build-Jdk entry.

    By doing this, we are starting Maven in a different JVM (the one specified in the jre tab) and that JVM is used to run maven, compile the project (according to the java version specified in the pom), and package it, and the manifest will have that version of JDK used to run maven.

    Having said that, I think having the wrong Build-Jdk in the MANIFEST.MF generated by RAD should not affect during development, given that this fields apparently is used to identify which java version was used to compile classes. Have you identified a problem caused by having the Build-Jdk value set to 1.7.0 instead of 1.6.0?

     

    Thanks for the workaround,  One thing that I observe, the goal field - if I click on "Select" button next to the goal field, it bring up a Select Goal

    dialog, there is nothing to be selected.

    If I enter "package" directly, the "OK" button is still disabled, so I ended up pressing cancel.

    What I need to do is to go back to the previous page and enter the "package" into the Goal field directly.

    Is this a known product defect?

     

     

  • rsanchezh
    rsanchezh
    47 Posts

    Re: Cannot change JDK 1.7 in Manifest.MF for Maven project to java compiler specified jdk 1.6 version in RAD 85.x

    ‏2013-06-14T15:18:44Z  
    • ivyho
    • ‏2013-06-12T17:30:20Z

    Thanks for the workaround,  One thing that I observe, the goal field - if I click on "Select" button next to the goal field, it bring up a Select Goal

    dialog, there is nothing to be selected.

    If I enter "package" directly, the "OK" button is still disabled, so I ended up pressing cancel.

    What I need to do is to go back to the previous page and enter the "package" into the Goal field directly.

    Is this a known product defect?

     

     

    Hi, yes, that is a know issue and will be handled in a future release. If you need more information, can contact IBM  Rational support:

    http://www-01.ibm.com/software/rational/support/contact.html?rcss=rtlrad