JPMS-Compatibility
Brought to you by:
aruckerjones,
sconway
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.
I forgot: currently opencsv can be used on the module-path by adding
to the module-info.java which works fine (besides the warning)
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.
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
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
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
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.