flyingsaucerproject / flyingsaucer

XML/XHTML and CSS 2.1 renderer in pure Java
Other
2.02k stars 565 forks source link

Add module name in MANIFEST.MF #377

Closed OpenHelios closed 2 months ago

OpenHelios commented 2 months ago

As long as the module-info.class file for the Jigsaw module system is not provided, adding an attribute named Automatic-Module-Name to the MANIFEST.MF file will help to use it as an automatic module. The value should be the module name used in the future, e.g.

Automatic-Module-Name: flying.saucer

Then the library can be used easier and more stable in a modularized project by adding a line

requires flying.soucer;

to the module-info.java file.

See also https://stackoverflow.com/questions/46741907/what-is-an-automatic-module

OpenHelios commented 2 months ago

Added PR #378 to fix this.

asolntsev commented 2 months ago

Implemented in https://github.com/flyingsaucerproject/flyingsaucer/pull/378

asolntsev commented 2 months ago

@OpenHelios Released flying-saucer-pdf:9.9.2, could you please try?

OpenHelios commented 2 months ago

Test using requires flying-sourcer; in module-info.java was successful with

implementation 'org.xhtmlrenderer:flying-saucer-core:9.9.2'

in gradle.build file in node dependencies and mavenCentral() in node repositories.

asolntsev commented 2 months ago

So the issue is fixed?

P.S. @OpenHelios May I ask, why do you import "core", not "pdf"? How do you use it? I thought "core" without "pdf" is useless...

OpenHelios commented 2 months ago

Yes, the issue for me is fixed with version 9.9.2. I have tested also to generate a PDF by using requires flying.sourcer.pdf, which is now working without any warnings by Gradle. In my current project I want to convert an HTML file to an image file, where the flying.sourcer.core library fits exactly to my requirements. A PDF file is not needed for my use case.

Normally a non modularized library can be referenced with the library file name, but Gradle 8.10 shows a compile error with flying-sourcer-core version 9.9.1 with this error message:

module-info.java:8: Error: Module not found: flying.saucer.core
  requires flying.saucer.core;

The new version 9.9.2 of flying-sourcer-core defines the automatic module name flying.sourcer in the MANIFEST.MF file and then Gradle compiles successfully, if I use requires flying.sourcer in the module-info.java file.

PS: Elevators manufactured by Otis have a display, where the content can be changed with the provided service, but only with an image file...