drewnoakes / metadata-extractor

Extracts Exif, IPTC, XMP, ICC and other metadata from image, video and audio files
Apache License 2.0
2.53k stars 473 forks source link

Add Automatic-Module-Name #621

Closed tsmock closed 4 months ago

tsmock commented 10 months ago

This fixes #566, and is probably preferable to https://github.com/drewnoakes/metadata-extractor/pull/620 .

tsmock commented 7 months ago

Patch ping: Is there anything else I need to do?

drewnoakes commented 7 months ago

The issues here are my unfamiliarity with Java modules, concerns raised about minimum Java version requirements and the fact that our dependency xmp-core is not modular.

With this addition, can we still compile with Java 8 and target Java 6?

tsmock commented 7 months ago

Yes, you can still compile with Java 8 and target Java 6 with this patch. All this does is modify the META-INF/MANIFEST.MF like so:

Manifest-Version: 1.0
Implementation-Title: metadata-extractor
+Automatic-Module-Name: com.drew.metadata
Implementation-Version: 2.18.0
Build-Jdk-Spec: 1.8
Created-By: Maven Archiver 3.4.0
Main-Class: com.drew.imaging.ImageMetadataReader
Implementation-Vendor: Drew Noakes

Java 8 and lower don't use the Automatic-Module-Name property. Java 9+ can.

EDIT: To add on, the Automatic-Module-Name property is specifically for enabling the Java ecosystem to slowly migrate to the module system while waiting on dependencies to do the migration. This does not require xmp-core to have module information. Using module-info.java would require xmp-core to have module information for stability reasons.

tsmock commented 4 months ago

Patch ping: Is there anything else I need to do?

drewnoakes commented 4 months ago

Thanks for the change and explanation. This looks good to me and no one has expressed any concerns, so I'll merge this.