You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

IntelliJ中Maven刷新后模块无法找到,寻求快速修复方案

问题:IntelliJ 2023.2.5中Maven模块化项目构建随机失败

项目基础信息

  • 项目首个模块包含10个单元测试,其module-info.java代码如下:
module fr.ecoemploi.domain.utils {
   requires org.slf4j;
   requires org.apache.commons.lang3;

   exports fr.ecoemploi.domain.utils.objets;
   exports fr.ecoemploi.domain.utils.autocontrole;
}
  • 命令行执行mvn clean install可正常完成编译并通过所有测试。

IntelliJ中的异常现象

  • 刷新整个Maven项目时结果随机:有时项目及测试可正常编译运行,有时启动测试会抛出错误:

Error occurred during initialization of boot layer
java.lang.module.FindException: Module fr.ecoemploi.domain.utils not found

  • 执行「Build Project」或「Rebuild Project」重建整个应用时,会出现多个模块找不到的错误:

module not found: fr.ecoemploi.domain.utils
module not found: org.slf4j
module not found: org.apache.commons.lang3
module not found: io.swagger.v3.oas.annotations
module not found: java.validation

  • 右键单独重建该模块时,构建及单元测试均可成功,但无法在IDE中完成整个应用的构建与测试,只能切换到命令行使用Maven操作。

当前临时方案及痛点

  • 临时修复方式:尝试「Repair IDE」、重启IDE,部分情况需要删除.idea文件夹(会丢失个人配置)
  • 核心痛点:每次恢复IDE正常识别项目需耗时约1.5小时,急需快速修复的方法。

内容的提问来源于stack exchange,提问作者Marc Le Bihan

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.06 02:22:39