2

I'm trying to create a simple modular programming application.

My project consists of two modules-

  1. com.module.model

  2. com.module.util

when I'm trying to export the module com.module.model in module-info.java.

IntelliJ cannot find the package to import.

(However it should give me the error of module not found)

The same problem stands for 'requires module' too.

I have provided all the modules in the dependencies for com.module.model

com.module.model

module dependency

Solutions I already tried-

  1. Build the modules separately (before adding the export line) and the whole project (maven clean install) as whole.

  2. Invalidated caches and restarted.

  3. SDK and Language level is set to 11.

4

1 回答 1

4

您需要在IntelliJ 项目com.module.model的文件夹中创建这些包等。java

在 IntelliJ 中,您命名为com.module.model“IntelliJ 模块”名称的目录与“Java 模块系统”无关,因为您将使用从该项目生成的工件。

在与问题类似的行上添加屏幕截图。它看起来像:

在此处输入图像描述

于 2019-11-19T16:20:21.200 回答