Multiple Java 9 modules from a single Maven module?

Alex Bondar :

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?

Nicolai :

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.)

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=465111&siteId=1