1

I am trying to modularize a JHipster 5 (Spring Boot 2) application and I ran into a split package problem.

In module-info.java I have the following conflicting automatic modules:

requires problem.spring.web;
requires problem;
requires jackson.datatype.problem;

When I build the project with Maven, I get several errors due to conflicting package name org.zalando.problem like this:

error: the unnamed module reads package org.zalando.problem from both problem and jackson.datatype.problem
error: module problem.spring.web reads package org.zalando.problem from both jackson.datatype.problem and problem

I would like to know how can I solve this issue. Would I have to wait for the third party library to be modularized too? What would be a nice way to solve this conflict?

This article explains a bit on how to solve Split Packages problems. I applied it to solve the split package between jsr305 and java.xml.ws.annotation by using --patch-module argument when building, as explained here. However the project did not compile when I tried the same for these packages.

The source for this project is available on GitHub

djeison
  • 490
  • 2
  • 5
  • 20

1 Answers1

0

If you want to use JARs that split a package as modules, --patch-module is the only way, but it's an arduous one. Beyond patching, you also need to craft the rest of the module graph. Say you're patching module megacorp with the content of start.up, then:

  • you have to make megacorp read all of start.up's dependencies with --add-reads
  • you have to make all modules that use start.up read megacorp with --add-reads
  • you have to ensure that start.up is not on the module path

This can be quite complicated, particularly if you're fighting Maven along the way. Are you sure, there is no way to simply merge the two artifacts?

If not, I'd say this project might not be ready for modularization.

Nicolai Parlog
  • 47,972
  • 24
  • 125
  • 255