简体   繁体   English

单个Maven模块中的多个Java 9模块?

[英]Multiple Java 9 modules from a single Maven module?

I have an interesting concern. 我有一个有趣的担忧。 I am used to multi-module Maven projects. 我习惯了多模块Maven项目。 Now I am investigating how to do the same but also using Jigsaw. 现在我正在调查如何做同样的事情,但也使用Jigsaw。 Am right that every single Maven Module can have only one Jigsaw module? 是的,每个Maven模块只能有一个Jigsaw模块吗? In IDE I can't create the second one inside the same Maven module. 在IDE中,我无法在同一个Maven模块中创建第二个。

So, is there any convention or workaround so far how to combine both sides of modules? 那么,到目前为止,是否有任何约定或解决方法如何组合模块的两面?

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. 当Project Jigsaw开发Java平台模块系统时,它决定模块化JAR是一个常规JAR ,在其根文件夹中有一个模块描述符 ,一个module-info.class That means a JAR can only define a single module. 这意味着JAR只能定义一个模块。 There have been request for multi-module JARs, but the feature was deferred to a future release . 已经有多模块JAR的请求,但该功能被推迟到将来的版本中

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. JPMS模块和JAR之间的一对一关系与Maven的Maven模块和JAR之间的一对一关系一起导致Maven模块只能包含一个JPMS模块。

(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.) (我创建了一个模块系统教程一个相应的演示项目 ,它使用多模块Maven构建来创建模块 - 也许它们对你很有帮助。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM