Tuesday, September 26, 2017

Letter to our OSGi User Community RE: the Java Platform Module System (JPMS)

Letter to the OSGi User Community:

With the JCP Executive Committee’s acceptance of JSR 376, the Java Platform Module System (JPMS) will be included in the Java SE 9 release. The OSGi Alliance has recently completed an analysis of JPMS and what it means for our user community.

We recognize that many of you have invested in OSGi technology over a number of years and have business-critical systems that rely on OSGi, so you may question if and how Java SE 9 may impact you. Please be assured that OSGi will continue to operate with its full capabilities on top of the new Java SE 9 platform.

However, the modularity capabilities in OSGi and JPMS are not the same. Our modularity experience, earned through the evolution of OSGi, has proven there are specific requirements in modularizing an application that is assembled with code from multiple sources, which have independent release cycles. Given these requirements, JPMS is not suitable for most real-world applications and we therefore caution against the use of JPMS for the application layer.

As you know, the modularization of an application, where code and dependencies are pulled from many independently created sources, presents a different set of challenges than those faced in the modularization of a defined and closely managed platform. This difference is especially true when the entire code base is managed by a single entity and released all at once, like the Java platform.

For more than 15 years, OSGi has proven successful in modularizing user applications by using dynamic resolution and semantic versioning, as well as supporting isolation, multiple class loaders and dependency injection. With its goal of modularizing the platform, JPMS has been able to rely upon static dependency resolution and ignore versioning, deferring responsibility for versioning to others.

Clearly, both OSGi and JPMS will co-exist and effectively operate in this application/platform demarcated environment. The modularization of the Java platform with Java SE 9 is a significant step forward for Java as a whole, and OSGi technology’s role in application-level modularization is as important today as it has been for previous releases of Java.

If you have any technical questions, please post them to osgi-dev@mail.osgi.org or, if you prefer an off-list inquiry, email modularity@osgi.org.

Dan Bandera
OSGi Alliance

Java is registered trademark of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. OSGi is a trademark or a registered trademark of the OSGi Alliance in the United States, other countries, or both.

1 comment:

  1. I see a big problem in the future, and are really hoping I have misunderstood something :-)

    The problem as I see it is all the 3rd party tools out there in maven central / Bintray JCenter. Of course you use a lot of the libraries out there even in OSGi and those of them that is not OSGi aware you include as a local bundle dependency.

    Even in the future you want to use such libraries. But when you do a JPMS application the libraries also needs to be JPMS modularized. Even though there apparently is a tool to repackage a non JPMS lib into a JPMS exporting all, this is problematic in that libraries no longer can be downloaded and used as is from maven central/jcenter. You would have to get and convert these and put them in a nexus/artifactory/bintray/whatever. But when it comes to OSGi and more a more libraries in the future will adopt to JPMS and thus no longer work outside of JPMS (I unfortunately see this as likely to happen), and then be totally unavailable to OSGi bundles.

    So I see 3 possibilities:
    1. Bad 3dr party library support for OSGi.
    2. Bad 3rd party library support for JPMS coninues.
    3. Most 3rd party libraries will be made both in an non JPMS and a JPMS version.

    My longterm guess is 1, but I really hope I’m wrong, or as I said there is something in all this that I have completely missunderstood, and the problems I see does not exists. I can’t remember any time in my life where I actually wanted to be this totally wrong before :- ).