IDEA报错: java: JPS incremental annotation processing is disabled 解决

起因

换了个电脑打开了之前某个老项目IDEA启动springcloud其中某个服务直接报错,信息如下

java: JPS incremental annotation processing is disabled. Compilation results on partial recompilation may be inaccurate. Use build process "jps.track.ap.dependencies" VM flag to enable/disable incremental annotation processing environment.

表现情况就是一直在编译中,只能强制退出IDEA

解决方法

尝试了网上多个方法

  1. lombok版本不兼容升级(吐槽:其他人都正常就我要升级,不合理吧。。。。)

  2. 打开"File" > "Settings"(对于macOS是"IntelliJ IDEA" > "Preferences")。

    导航到"Build, Execution, Deployment" > "Compiler"。

    在"Shared build process VM options"中添加或修改VM选项:

    -Djps.track.ap.dependencies=true (看着好像很有道理跟报错信息也对的上,但是没起效果)

  3. 清理缓存 (没有效果)

最终解决方法

打开项目中的.idea文件夹,找到complier.xml文件

看到这个标签 annotationProcessing

错误示例

xml 复制代码
<annotationProcessing>
	<profile default="true" name="Default" enabled="true" />
	<profile name="Maven default annotation processors profile" enabled="true">
		<sourceOutputDir name="target/generated-sources/annotations" />
	        <sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
	        <outputRelativeToContentRoot value="true" />
	        <module name="A-server-api" />
	        <module name="A-server" />
	        <module name="B-server-api" />
	        <module name="B-server" />
	</profile>
	<profile name="Annotation profile for zsacloud" enabled="true">
	 <sourceOutputDir name="target/generated-sources/annotations" />
        <sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
        <outputRelativeToContentRoot value="true" />
        <option name="mapstruct.defaultComponentModel" value="spring" />
        <processorPath useClasspath="false">
          <entry name="$USER_HOME$/development/apache-maven-3.8.1/repository/org/mapstruct/mapstruct-processor/1.4.2.Final/mapstruct-processor-1.4.2.Final.jar" />
          <entry name="$USER_HOME$/development/apache-maven-3.8.1/repository/org/mapstruct/mapstruct/1.4.2.Final/mapstruct-1.4.2.Final.jar" />
          <entry name="$USER_HOME$/development/apache-maven-3.8.1/repository/org/projectlombok/lombok/1.18.6/lombok-1.18.6.jar" />
        </processorPath>
        <module name="A-server-api" />
</annotationProcessing>

正确示例

xml 复制代码
<annotationProcessing>
	<profile default="true" name="Default" enabled="true" />
	<profile name="Maven default annotation processors profile" enabled="true">
		<sourceOutputDir name="target/generated-sources/annotations" />
	        <sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
	        <outputRelativeToContentRoot value="true" />
	        <module name="A-server-api" />
	        <module name="A-server" />
	        <module name="B-server-api" />
	        <module name="B-server" />
	</profile>
	<profile name="Annotation profile for server" enabled="true">
	 <sourceOutputDir name="target/generated-sources/annotations" />
        <sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
        <outputRelativeToContentRoot value="true" />
        <option name="mapstruct.defaultComponentModel" value="spring" />
        <processorPath useClasspath="false">
          <entry name="$USER_HOME$/development/apache-maven-3.8.1/repository/org/mapstruct/mapstruct-processor/1.4.2.Final/mapstruct-processor-1.4.2.Final.jar" />
          <entry name="$USER_HOME$/development/apache-maven-3.8.1/repository/org/mapstruct/mapstruct/1.4.2.Final/mapstruct-1.4.2.Final.jar" />
          <entry name="$USER_HOME$/development/apache-maven-3.8.1/repository/org/projectlombok/lombok/1.18.6/lombok-1.18.6.jar" />
        </processorPath>
        <module name="A-server-api" />
        <module name="A-server" />
        <module name="B-server-api" />
        <module name="B-server" />
</annotationProcessing>

就是有两个标签下面有模块,但是发现下面丢了很多就剩下一个,补上之后,所有服务就可以正常编译启动了。。。(不知道啥原因,反正项目可以愉快的跑起来了,可能是IDEA没自动生成)

相关推荐
用户2986985301417 分钟前
Java 创建 CSV 文件的三种实用方法:从零构建、数组写入与 Excel 转换
java·后端·excel
Cry丶24 分钟前
一次 FTP 上传引发 504 Gateway Timeout 的排查复盘
java·nginx·ftp·openresty·被动模式·504 gateway·生产问题排查
码农进化录30 分钟前
Java 程序员的 AI 进化论 | AI 辅助 CI/CD,让 AI 帮你做代码审查和部署决策
java·spring boot·openai
zyplayer-doc32 分钟前
企业文档的进化:网盘和在线文档的下一个升级方向—知识库系统
java·大数据·数据库·人工智能·ocr
吃饱了得干活35 分钟前
从零设计一个高并发点赞系统:缓存+MQ异步持久化实战
java·架构
奇牙coding41 分钟前
gpt-5.6-luna 调用报 400 bad_request 怎么办?同样的 messages 在 gpt-5.5 没问题——两处校验差异和修复写法
java·windows·gpt·ai
凤山老林1 小时前
从“无法创建本地线程“异常说起:深度解析线程栈与JVM线程优化指南
java·开发语言·jvm
来自内蒙古的田园蒙牛1 小时前
WebStorm 接入 Ollama:使用 Qwen2.5-Coder 在本地运行 AI 编程助手
ide·人工智能·webstorm
聚美智数1 小时前
常见疾病查询-疾病症状—疾病介绍-疾病大全-疾病治疗查询API接口介绍
android·java·数据库
慧都小妮子2 小时前
Aspose.Words for JasperReports v26.6 发布,底层Java大升级
java·pdf·报表工具·aspose.words·文档转换·报表导出·jasperreports