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

IntelliJ多模块项目内Scala Maven模块保存后不自动编译问题

解决IntelliJ 2012.1.2 Scala Maven子模块无法自动编译问题

以下是可直接落地的排查解决步骤:

  • 确认IntelliJ Scala插件状态:打开File > Settings > Plugins,检查Scala插件已启用,且版本兼容2012.1.2版本IDE
  • 校验Scala Facet配置:右键Scala子模块,选择Open Module Settings > Facets,确认已添加Scala Facet,且关联的Scala SDK版本与scala-maven-plugin配置的Scala版本完全一致
  • 调整scala-maven-plugin配置:在Scala子模块的pom.xml中添加增量编译相关参数,参考配置如下:
<plugin>
  <groupId>net.alchim31.maven</groupId>
  <artifactId>scala-maven-plugin</artifactId>
  <version>3.3.2</version>
  <executions>
    <execution>
      <goals>
        <goal>compile</goal>
        <goal>testCompile</goal>
      </goals>
    </execution>
  </executions>
  <configuration>
    <recompileMode>incremental</recompileMode>
    <useZincServer>true</useZincServer>
  </configuration>
</plugin>
  • 补全IDE编译配置:
    • 打开File > Settings > Build, Execution, Deployment > Compiler,除已开启的Build Project Automatically,额外勾选Compile independent modules in parallel
    • 进入Compiler > Annotation Processors,确保Scala子模块的注解处理配置与正常编译的Java模块一致
    • 按Ctrl+Shift+A(Mac系统为Cmd+Shift+A)搜索并打开Registry,找到scala.compile.server.enable选项并勾选启用
  • 校验源码目录标记:右键Scala子模块下的src/main/scala目录,选择Mark Directory as > Sources Root,src/test/scala目录同理标记为Test Sources Root
  • 清理缓存重导项目:执行File > Invalidate Caches / Restart,选择「Invalidate and Restart」,重启后右键项目根目录选择Maven > Reimport重新加载Maven配置

内容的提问来源于stack exchange,提问作者Senthil

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.10.11 15:18:01