Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can Maven generate the module declaration?

Tags:

java

maven

java-9

The module declaration defines, among other things, a module's dependencies. If I use Maven as a build tool, this is redundant because the pom.xml already contains these (and more) information. Based on that, couldn't Maven generate the module-info.java for me?

like image 394
Nicolai Parlog Avatar asked Dec 19 '25 07:12

Nicolai Parlog


1 Answers

One might expect that most of the dependencies are indeed required modules as well. However, requirements can also point to modules of the JDK/JRE, which are not specified in the pom.xml. So yes, if you only look at the dependencies, probably most of them could be transformed to a required module reference.

But a module-descriptor contains much more information, which are all based on decisions to be made by the developer. I've written an article about it which describes in detail why it is not possible to fully generate this file.

like image 80
Robert Scholte Avatar answered Dec 20 '25 21:12

Robert Scholte