Package conflicts with automatic modules in Java 9

Am I using the new module system correctly?

Yes. What you are seeing is intended behavior, and this is because JPMS modules do not allow split packages.

In case you are not familiar with the term “split packages” it essentially means two members of the same package coming from two different modules.

For example:
com.foo.A (from moduleA.jar)
com.foo.B (from moduleB.jar)

What can I do about this error?

You have two options:

  1. (harder) “unsplit” the package dependencies. However this could be difficult or impossible if you are not familiar with the inner workings of the library
  2. (easier) combine the two jars into a single jar (and therefore a single automatic module) as you mentioned above. I agree that it is not a “good” solution, but having split packages in the first place is generally not a good idea either.

Do these dependencies prevent me from updating, or should I just wait for rx to update their libs?

Hopefully rx will eventually update their libs to not have split packages at some point in the future. Until then, my recommendation would be to just smash the two jars together into a single jar (option #2).

Leave a Comment