idea中添加module-info.java

idea创建模块默认不会带module-info.java,添加方法src目录单击右键->new
idea执行多模块java程序问题记录

Module is not in dependencies问题

module-info.java添加依赖模块时提示找不到依赖,需要在模块配置中增加依赖模块项,右键模块名->Open module Setting,如下图所示选择依赖模块
idea执行多模块java程序问题记录

Kotlin standard library is not found问题

Error:Kotlin: The Kotlin standard library is not found in the module graph. Please ensure you have the ‘requires kotlin.stdlib’ clause in your module definition
运行多模块程序需要加入Kotlin库,添加方法
idea执行多模块java程序问题记录

InvalidModuleDescriptorException Main.class found in top-level directory问题

module-info文件与执行的Class文件不能再同一个目录,Class文件必须在module-info所处目录的子目录。

错误的层级关系

idea执行多模块java程序问题记录

正确的层级关系

idea执行多模块java程序问题记录

相关文章:

  • 2021-08-23
  • 2021-11-25
  • 2021-09-20
  • 2022-03-06
  • 2021-10-26
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-02-12
  • 2021-12-14
  • 2021-09-11
  • 2022-12-23
  • 2021-11-19
  • 2021-09-03
  • 2023-03-20
相关资源
相似解决方案