Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide Modularization Support for tess4j (Module Descriptor module-info.java) #269

Open
astrapi69 opened this issue Nov 11, 2024 · 6 comments

Comments

@astrapi69
Copy link

Hi @nguyenq,

I'm currently using tess4j in a modular Java project and encountered issues because tess4j lacks a module descriptor (module-info.java). Without it, I’m unable to include tess4j as a module in my project, which leads to errors such as error: Modul not found: tess4j requires tess4j;.

Proposed Solution:

Could you please consider adding modularization support for tess4j by including a module-info.java file? This would allow projects using the Java module system to include tess4j seamlessly as a required module.

An example of the required module descriptor might look like:

module tess4j {
    requires java.base;
    requires java.desktop;
    // Add any other necessary dependencies
    exports net.sourceforge.tess4j; // Export your main package(s)
}

Benefits:

  • Supports Java projects using the module system.
  • Improves integration with modularized applications and modern Java practices.

Thank you for considering this enhancement. Modularization would greatly improve compatibility and ease of use for Java developers working with the module system.

@nguyenq
Copy link
Owner

nguyenq commented Nov 16, 2024

@astrapi69 Please submit a PR.

Thanks.

@astrapi69
Copy link
Author

Hello @nguyenq,

I have created and submitted a Pull Request to address the issue. The PR introduces a module-info.java file to provide modularization support for tess4j, ensuring compatibility with the Java Module System. It also updates the Maven Compiler Plugin configuration to target JDK 11.

Please feel free to review the changes, and let me know if there are any adjustments or additional enhancements required.

Thank you for considering this improvement, and I look forward to your feedback!

@nguyenq
Copy link
Owner

nguyenq commented Nov 25, 2024

@astrapi69 There was a warning during compile:

Required filename-based automodules detected: [jai-imageio-core-1.4.0.jar, lept4j-1.20.0.jar]. Please don't publish this project to a public artifact repository!

I think I'll need to modularize lept4j, but what about jai-imageio-core? How can it be addressed?

Thanks.

@astrapi69
Copy link
Author

Hi @nguyenq may we can make a fork and modularize also jai-imageio-core. I just forked it now and will try to upgrade to jdk11

@nguyenq
Copy link
Owner

nguyenq commented Dec 1, 2024

@astrapi69 I think it will need to be merged upstream to the original repo of jai-imageio-core, which hasn't received any code update for many years.

Alternatively, we can use a more actively developed image library TwelveMonkeys; however, a PR related to modularization has also been stuck in the neutral the past few years.

I probably will have to revert your PR to proceed with Tesseract 5.5.0 upgrade release.

@astrapi69
Copy link
Author

Hi @nguyenq,

Thank you for your feedback and for pointing out the challenges with jai-imageio-core and lept4j. I completely understand the need to prioritize the Tesseract 5.5.0 upgrade release.

To address these concerns:

For jai-imageio-core:
Since the original repository has not received updates in years, I have already forked it and started working on adding a module-info.java to modularize it. Once the changes are stable, I will test its compatibility with tess4j. However, I agree that merging the changes upstream would be the ideal solution, so I will also attempt to reach out to the maintainers.

Alternatively, I can investigate replacing jai-imageio-core with TwelveMonkeys. While its modularization PR has been delayed, I will assess if this library offers better long-term compatibility and modernization for tess4j.

For lept4j:
I’m happy to contribute to modularizing lept4j as a separate task. This will help reduce warnings and make tess4j’s modularization effort more robust.

Interim Solution:
If needed, I can help maintain a modularized branch of tess4j, allowing developers using the Java Module System to experiment with it. This can coexist alongside a non-modularized release for users not yet adopting modularization.

I hope these steps provide a clear path forward. Please let me know if there are any specific priorities or adjustments you'd like to see.

Best regards,
@astrapi69

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants