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

相关推荐
非 白1 分钟前
【Java分布式】Nacos注册中心
java·开发语言·nacos·注册中心
吃海鲜的骆驼7 分钟前
服务异步通讯与RabbitMQ
java·分布式·后端·rabbitmq
羱滒10 分钟前
sql调优之数据库开发规范
java·数据库·数据库开发
Forget the Dream39 分钟前
设计模式之责任链模式
java·c++·设计模式·责任链模式
jonyleek42 分钟前
「JVS更新日志」低代码、企业会议、智能BI、智能排产2.26更新说明
java·大数据·低代码·数据分析·软件需求
令狐少侠20111 小时前
Idea 和 Pycharm 快捷键
pycharm·intellij-idea·idea
计算机小白一个1 小时前
蓝桥杯 Java B 组之最短路径算法(Dijkstra、Floyd-Warshall)
java·数据结构·算法·蓝桥杯
曼岛_1 小时前
[密码学实战]Java实现SM4加解密(ecb,cbc)及工具验证
java·密码学
技术咖啡馆C1 小时前
二、IDE集成DeepSeek保姆级教学(使用篇)
ide·ai编程·idea-plugin·deepseek
吃汤圆的抹香鲸1 小时前
GoLand 安装包 绿色版 Win,Mac,Linux 包含IntelliJ全家桶 专为Go语言设计的集成开发环境(IDE)
linux·windows·macos·go·intellij-idea·go1.19