objectbox-java
objectbox-java copied to clipboard
Support the Java module system (JPMS)
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 :-).
Thanks for bringing this to our attention.
Notes:
- Gradle support for the Java module system is in 4.6 nightlies, so not stable, yet.
- This has nothing to do with Android (which is currently the main focus of the Java/Kotlin libraries).
Edit: also not documented, yet. And more links:
- https://github.com/square/okhttp/pull/3743
- https://blog.joda.org/2017/05/java-se-9-jpms-automatic-modules.html
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 ?