I have an interesting concern. I am used to multi-module Maven projects. Now I am investigating how to do the same but also using Jigsaw. Am right that every single Maven Module can have only one Jigsaw module? In IDE I can't create the second one inside the same Maven module.
So, is there any convention or workaround so far how to combine both sides of modules?
A multi-module project is built from an aggregator POM that manages a group of submodules. In most cases, the aggregator is located in the project's root directory and must have packaging of type pom. The submodules are regular Maven projects, and they can be built separately or through the aggregator POM.
Actually, we can! In this tutorial, we'll learn how to create a multi-module Maven application using Java modules.
Yes you can use Maven Profiles to manage this. Obviously you can tweak this approach to suit your needs however works best.
When Project Jigsaw developed the Java Platform Module System it decided that a modular JAR is a regular JAR with a module descriptor, a module-info.class
, in its root folder. That means a JAR can only define a single module. There have been request for multi-module JARs, but the feature was deferred to a future release.
That one-to-one relationship between JPMS modules and JARs taken together with Maven's one-to-one relationship between Maven modules and JARs leads to the fact that a Maven module can only contain a single JPMS module.
(I created a module system tutorial and a corresponding demo project that uses a multi-module Maven build to create modules - maybe they're helpful to you.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With