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?
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.
jdeps
(in jdk-9/bin
) can generate an initial descriptor based on the compiled code. But it cannot become part of the lifecycle, because it has to be adjusted by hand. –
Ablepsia As far as I know, bnd-maven-plugin
can generate module-info.class
based on the configured dependencies. If you are working with maven-bundle-plugin
, you need to specify the version of bndlib manually, for the latest version of maven-bundle-plugin(5.1.3) is still using the 5.x version of bndlib, and bndlib requires 6.x to support jpms.
Document: https://bnd.bndtools.org/releases/6.1.0/chapters/330-jpms.html
© 2022 - 2024 — McMap. All rights reserved.
requires java.sql
how should Maven know about this? What about the module name? Based on what should it be guessed ? artifactId? Will not work....I recommend to read the Maven DEV list about the Jigsaw keyword...Apart from that what about transitive dependencies? – Patterman