Menu

#147 JPMS-Compatibility

wont-fix
JPMS (1)
5
2021-07-04
2021-03-16
No

Currently opencsv neither provides a module-info.java nor a MANIFEST.MF entry defining an automatic module name which leads to warnings (or even errors depending on the compiler-settings) reading like

Name of automatic module 'opencsv' is unstable, it is derived from the module's file name....

For a quick fix I'd suggest an entry to MANIFEST.MF reading something like

Automatic-Module-Name: com.opencsv.opencsv

This will at least fix the warning but probably not some other quirks coming up by using automatic modules. (apache commons-collections uses this approach)

On the long run a real module-info.java would be the best way.

Discussion

  • Stephanus Mueller

    I forgot: currently opencsv can be used on the module-path by adding

    requires opencsv;

    to the module-info.java which works fine (besides the warning)

     
  • Scott Conway

    Scott Conway - 2021-03-16
    • assigned_to: Scott Conway
     
  • Scott Conway

    Scott Conway - 2021-03-16

    The Manifest.MF file is automatically generated so I added the Automatic-Module-Name to the maven-jar-plugin entry in the pom.xml.

    However when I build I do not see the entry so check the pom.xml and see if it works for you.

    My theory is that because we support Java 8 as it is still a maintained LTR release the entry was not created. If that is the case I will leave the entry there for anyone who wants to build opencsv for themselves.

     
  • Stephanus Mueller

    I just downloaded the sources and tried it myself and stumbled across a glitch with Maven:

    MANIFEST.MF in the target/classes-folder does not contain the Automatic-Module-Name whereas the MANIFEST,MF extracted from the generated SNAPSHOT-jar does
    (see attachments)
    $ diff MANIFEST.MF.from-classes-folder MANIFEST.MF.from-Snapshot-jarfile

    2c2
    < Bnd-LastModified: 1615976656971


    Created-By: Apache Maven Bundle Plugin
    3a4,5
    Automatic-Module-Name: com.opencsv
    Bnd-LastModified: 1615976656971
    10d11
    < Created-By: Apache Maven Bundle Plugin
    46a48

    I built opencsv with JDK 15 (unchanged pom) and MVN 3.6.3
    Copying the created manifest into the 5.4-distribution works fine you have to add

    requires com.opencsv;

    to the module-info.java instead of the pure "opencsv" before.
    Would be a great hint for the next release for JPMS-users
    Thanks
    StM

     
  • Scott Conway

    Scott Conway - 2021-07-04
    • status: open --> wont-fix
     
  • Scott Conway

    Scott Conway - 2021-07-04

    Hello Stephanus

    Sorry but I am closing this as not fix. The reason being is that while yes you can compile opencsv with java versions up to 15 thanks to the work of Andrew Jones it is primarily designed to be built with Java 8 and because of the MASSIVE amount of hate we received when we first upgraded to Java 7 while Java 6 was still a supported release it will remain this way as long as Java 8 is supported.

    That said there is no way of automatically generating a manifest file with your requirements (ie requires) in Java 8. And hand creating a file means a file that can fail without us (those who use opencsv with Java 8) knowing about it.

    If you can find a way of generating the Manifest.MF file that you need with Java 8 then create a new ticket and we will revisit the issue.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.