Hello!

I'm curious if anyone's given any thought to deriving Java 9 module
descriptors from OSGi manifests.

Right now, in a pre-JDK9 world, it's standard practice to produce jar
files that are OSGi bundles when used in an OSGi context, and ordinary
pile-of-classes jar files when used on the Java classpath. In other
words, builds generally produce a single jar file that:

  - Works as an OSGi bundle when used in an OSGi context
  - Works as an ordinary jar when used on the classpath

However, when JDK9 appears, it introduces the concept of modular jars.
Those work somewhat differently and require the addition of a module
descriptor in the JAR file (assuming that "automatic modules" are not
used). In other words, a build should (assuming that compatibility with
older JVMs is desirable) produce a jar file that:

  - Works as an OSGi bundle when used in an OSGi context
  - Works as a modular jar when used on the module path in Java >= 9
  - Works as an ordinary jar when used on the traditional classpath

Given that the information expressible in a Java 9 module descriptor
seems to be a subset of that defined in OSGi manifests, it seems like
it would be possible if not necessarily easy to derive a Java 9 module
descriptor from data given in OSGi manifests as part of the build
process. I personally am not looking forward to having to maintain
two very nearly if not completely identical sets of metadata regarding
the imports and exports of packages.

Anyone looked at this?

M

Attachment: pgpUf1E6POri6.pgp
Description: OpenPGP digital signature

_______________________________________________
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to