Open Burtan opened 4 years ago
Thanks for bringing this to our attention.
Notes:
Edit: also not documented, yet. And more links:
Any update on a time schedule for this? Or is this on low priority?
Are the prerequisites (e.g. Gradle) now in place (cc @greenrobot-team)?
At least Gradle 6.4 is released.
Yes, as far as I can tell.
So to do this our Java and Android libraries should not ship code in the same package, which is disallowed with the module system, no? Edit: via #1163, the java and java-api JAR also contain overlapping packages.
Then add the "Automatic-Module-Name" MANIFEST.MF entry with the future module name.
Also, all dependencies should be modularized and have an automatic module name? Quoting jodastephen:
Do not release to Maven Central a modular jar file that depends on an automatic module, unless the automatic module has an "Automatic-Module-Name" MANIFEST.MF entry.
If this is true, we need to migrate away from com.google.code.findbugs:jsr305
. Unsure about other dependencies (e.g. essentials and flatbuffers will be runtime only).
One more thing to keep in mind. Android does not support JPMS and it relies on byte code < JDK8. So libraries have to compile the java-module.info file with JDK9+ and the rest with JDK8. Java-Modularity plugin for gradle might help.
Is this addressed with Objectbox 3.0.0+?
Any news on this? Meanwhile gradle 6.8.1 enables module support by default.
No updates because there are no updates :)
I tried to get ObjectBox 3.0.0-alpha2 working with JPMS. It is better than 2.x.x because io.objectbox.converter is no longer split across two packages (java and java-api). I was able to generate module names using this plugin
id("de.jjohannes.extra-java-module-info") version "0.3"
However, the objectbox gradle plugins makes all modules fail.
/.../src/main/java/module-info.java:2: error: module not found: kotlin.stdlib
requires kotlin.stdlib;
If the gradle errors are fixed I think Objectbox 3.0.0-alpha2 could be used with JPMS without too much trouble. If it helps I could create an example repo on github.
any update on this ?
waiting for fixing this issue, any updates??
@IranLaserProgrammer Does lack of support for the module system prevent using ObjectBox in your project? If yes, can you share some details on what you are trying to do? I'm just trying to get a feeling on how important this is.
Hi @greenrobot-team , thanks for responding to this , this is also a problem when using this on other platforms like Desktops, where in most cases, Java projects use the module system by default (which doesn't mean we can ignore modules). In my case, I would imagine it's the same for other developers—to benefit from the module tools. However, in many cases, one can hit a brick wall when it comes to Gradle. I am a big fan of this project, but I realized there was no workaround for this in one of my projects. I had to remove the module info file just to accommodate the database. You can imagine the pain points as one of the users here.
@kinsleykajiva thanks. I still need to research this more. If I see this correctly this requires compiling with Java language level 9 to spot any errors. However, to support as many Android versions as possible, then to release a version compiled with language level set to Java 8. Then, the library might not work on Android at all (info from 2018 though).
Maybe it can be enough to just add and reserve a module name for each Maven artifact (Automatic-Module-Name
attribute), so it's future proof to use the libraries in a module-based project.
In any case, can't find any good resource on migrating an existing library. So tips are welcome!
Created an internal issue for this (objectbox/objectbox-java#211
).
I am creating a desktop application with java in IntelliJ. Because of this problem i can't have a modular base project and this is a problem. I lose the advantages of a modular project. Hope you fix it soon. Tnx
Any plans to support Java Platform Module System (JPMS)? Currently I get errors on a minimal gradle kotlin jpms example and I couldn't find any documentation on jpms with objectbox. It's finally pushed with future gradle versions. So it would be nice to add support :-).