0

I have an existing Multi modules maven project (in Java 8), one of thoses modules is a webapp which produce a war file deployed into Tomcat 9.

I planned to migrate to Java 11. I am wondering if there is a benefit of adding java modularity to my project (i.e. creating a module-info.java for each maven modules) ?

Is there any benefit of adding Java Modularity when producing a war file (maven will already add all its dependencies in WEB-INF/lib) ?

At final, I suppose Tomcat is not using Java modularity when deploying the war ? So, I can't see any benefit of using Java modularity in a web environment, maybe I am missing something ?

Olivier Boissé
  • 15,834
  • 6
  • 38
  • 56
  • 2
    See more details https://stackoverflow.com/q/46497172/296328 apart from that currently I don't see any reason to use java modularity for a resulting WAR file... – khmarbaise Mar 23 '19 at 19:42
  • yes I saw this post, but the answer was posted in 2017. So even in 2019, java modularity is not ready for webapp environment ? – Olivier Boissé Mar 23 '19 at 19:51

1 Answers1

0

I guess it depends on whether or not you are experiencing problems that modulization was intended to fix. I work in a Spring microservices team. We did not start using modules when we migrated to Java 10 from 8. Mainly because we were not encountering the problems that modules was intended to fix... like conflicting library dependencies, or large packages. So no need for the extra complexity.

Jose Martinez
  • 11,452
  • 7
  • 53
  • 68
  • I agree with you, that's why I am not planning to use it, everything works perfectly fine without modularity. I also see that Spring initializr is not adding module-info.java when creating a java 11 spring project... – Olivier Boissé Mar 23 '19 at 19:46