When trying to compile a Spring Boot 3.0.3 Project with Java 17 (tested with 17.0.6) and Maven 3.8 (tested with 3.8.5 and 3.8.7) (or IntelliJ 2022.3.2) using Spring Webflux with Java modules one receives the following error, indicating a split package:
the unnamed module reads package org.springframework.web.service.invoker from both spring.web and spring.webflux
module spring.webflux reads package org.springframework.web.service.invoker from both spring.web and spring.webflux
module spring.web reads package org.springframework.web.service.invoker from both spring.webflux and spring.web
I have created a really bare-bone project as a minimal example: MRE.zip
It was retrieved by stripping almost everything from a bigger production workload. The combination of other dependencies in the pom.xml or module-info.java has no effect on the error, as can be seen in the minimal example above as well in the larger application by removing or adding different combinations of other dependencies.
When adding the --add-reads=backend=ALL-UNNAMED to the maven-compiler-plugin and commenting out either spring.web or spring.webflux in the module-info.java everything compiles fine.
Both are necessary, however as otherwise it does not find certain classes from these modules (at least in the bigger application, that has real content).
Any help is greatly appreciated. Thank you.
Comment From: philwebb
I think this is a duplicate of https://github.com/spring-projects/spring-framework/issues/30042