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没自动生成)

相关推荐
CoderYanger7 分钟前
递归、搜索与回溯-综合练习:27.黄金矿工
java·算法·leetcode·深度优先·1024程序员节
vx_vxbs6622 分钟前
【SSM高校普法系统】(免费领源码+演示录像)|可做计算机毕设Java、Python、PHP、小程序APP、C#、爬虫大数据、单片机、文案
android·java·python·mysql·小程序·php·idea
张较瘦_23 分钟前
Springboot3 | ResponseEntity 完全使用教程
java·springboot·开发
毕设源码-郭学长24 分钟前
【开题答辩全过程】以 高校兼职系统为例,包含答辩的问题和答案
java·spring boot
黄嚯嚯25 分钟前
Jackson 多态反序列化详解:基于字段自动选择子类的优雅方案
java
h***381832 分钟前
SpringBoot - Cookie & Session 用户登录及登录状态保持功能实现
java·spring boot·后端
一只乔哇噻35 分钟前
java后端工程师+AI大模型进修ing(研一版‖day57)
java·开发语言·人工智能·算法·语言模型
十五喵36 分钟前
智慧物业|物业管理|基于SprinBoot+vue的智慧物业管理系统(源码+数据库+文档)
java·前端·数据库·vue.js·spring boot·毕设·智慧物业管理系统
Williams1043 分钟前
Java POI/Excel工具:终结OOM、精度丢失和i18n三大难题
java·开发语言·excel
k***81721 小时前
IDEA搭建SpringBoot,MyBatis,Mysql工程项目
spring boot·intellij-idea·mybatis