IntelliJ多模块项目资源文件夹未被处理问题求助
多模块项目资源识别&编译问题解决
1. 检查IntelliJ IDEA模块配置
- 打开
File > Project Structure > Modules,选中对应子模块(Child A/Child B) - 切换到
Sources标签,确认src/main/resources被标记为Resources(蓝色文件夹图标),若未标记,右键该文件夹选择Mark Directory as > Resources Root - 切换到
Paths标签,确认Output path和Test output path指向子模块自身的target/classes和target/test-classes,而非父模块的out目录
2. 修正子模块Maven资源配置
在子模块的pom.xml中明确资源路径,避免继承父模块的错误配置:
<build> <resources> <resource> <directory>src/main/resources</directory> <includes> <include>**/*</include> </includes> </resource> </resources> <testResources> <testResource> <directory>src/test/resources</directory> <includes> <include>**/*</include> </includes> </testResource> </testResources> </build>
- 若父模块有统一build配置,检查是否覆盖了子模块资源路径,必要时在子模块中添加上述配置覆盖父设置
3. 清理IDEA缓存并重建项目
- 执行
File > Invalidate Caches...,勾选Clear file system cache and local history,点击Invalidate and Restart - 重启后在Maven面板中,依次执行子模块的
clean > compile > package命令,确认子模块下生成target文件夹,且target/classes/db/changelog/db.changelog-master.yml存在
4. 调整IDEA编译输出设置
- 打开
File > Settings > Build, Execution, Deployment > Compiler,勾选Build Project automatically - 切换到
Build, Execution, Deployment > Build Tools > Maven > Runner,勾选Delegate IDE build/run actions to Maven,让IDEA完全使用Maven编译逻辑,避免路径冲突
5. 确认Liquibase配置路径
检查子模块的application.yml(或properties)中Liquibase路径配置,确保指向子模块资源目录:
spring: liquibase: change-log: classpath:db/changelog/db.changelog-master.yml
内容的提问来源于stack exchange,提问作者Stachu
相关产品推荐
相关产品推荐

