Maven可以生成模块声明 [英] Can Maven generate the module declaration

查看:105
本文介绍了Maven可以生成模块声明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

模块声明定义了以下内容:模块的依赖关系。如果我使用Maven作为构建工具,这是多余的,因为 pom.xml 已经包含这些(和更多)信息。基于此,Maven不能为我生成 module-info.java 吗?

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?

推荐答案

有人可能会认为大多数依赖项确实也是必需的模块。但是,需求也可以指向JDK / JRE的模块,这些模块未在 pom.xml 中指定。所以,是的,如果您只查看依赖项,可能大部分都可以转换为必需的模块引用。

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.

这篇关于Maven可以生成模块声明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆