转载

java: Internal error in the mapping processor: java.lang.NullPointerException 问题

就在昨天,因为项目需要,所以就升级了整体的依赖版本,也包括了Springboot、Lombok、MapStruct版本(没错,主要就是因为这三个依赖和Idea版本的原因)。这一升级就出问题了,我用的是Idea2022.1版本,一启动就编译不通过,但是我同事他们都可以正常的启动项目。于是就各种百度找问题,但奈何都不解决我这个问题。

错误信息

java: Internal error in the mapping processor: java.lang.NullPointerException 
at org.mapstruct.ap.internal.processor.DefaultVersionInformation.createManifestUrl(DefaultVersionInformation.java:182) 
at org.mapstruct.ap.internal.processor.DefaultVersionInformation.openManifest(DefaultVersionInformation.java:153) 
at org.mapstruct.ap.internal.processor.DefaultVersionInformation.getLibraryName(DefaultVersionInformation.java:129) 
at org.mapstruct.ap.internal.processor.DefaultVersionInformation.getCompiler(DefaultVersionInformation.java:122) 
at org.mapstruct.ap.internal.processor.DefaultVersionInformation.fromProcessingEnvironment(DefaultVersionInformation.java:95) 
at org.mapstruct.ap.internal.processor.DefaultModelElementProcessorContext.<init>(DefaultModelElementProcessorContext.java:50) 
at org.mapstruct.ap.MappingProcessor.processMapperElements(MappingProcessor.java:218) 
at org.mapstruct.ap.MappingProcessor.process(MappingProcessor.java:156) 
at org.jetbrains.jps.javac.APIWrappers$ProcessorWrapper.process(APIWrappers.java:109) 
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
at java.lang.reflect.Method.invoke(Method.java:498) 
at org.jetbrains.jps.javac.APIWrappers$1.invoke(APIWrappers.java:213) 
at org.mapstruct.ap.MappingProcessor.process(Unknown Source) 
at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:794) 
at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:705) 
at com.sun.tools.javac.processing.JavacProcessingEnvironment.access$1800(JavacProcessingEnvironment.java:91) 
at com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1035) 
at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1176) 
at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1170) 
at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:856) 
at com.sun.tools.javac.main.Main.compile(Main.java:523) 
at com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:129) 
at com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:138) 
at org.jetbrains.jps.javac.JavacMain.compile(JavacMain.java:231) 
at org.jetbrains.jps.incremental.java.JavaBuilder.compileJava(JavaBuilder.java:501) 
at org.jetbrains.jps.incremental.java.JavaBuilder.compile(JavaBuilder.java:353) 
at org.jetbrains.jps.incremental.java.JavaBuilder.doBuild(JavaBuilder.java:277) 
at org.jetbrains.jps.incremental.java.JavaBuilder.build(JavaBuilder.java:231) 
at org.jetbrains.jps.incremental.IncProjectBuilder.runModuleLevelBuilders(IncProjectBuilder.java:1441) 
at org.jetbrains.jps.incremental.IncProjectBuilder.runBuildersForChunk(IncProjectBuilder.java:1100) at org.jetbrains.jps.incremental.IncProjectBuilder.buildTargetsChunk(IncProjectBuilder.java:1224) at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunkIfAffected(IncProjectBuilder.java:1066) at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunks(IncProjectBuilder.java:832) at org.jetbrains.jps.incremental.IncProjectBuilder.runBuild(IncProjectBuilder.java:419) at org.jetbrains.jps.incremental.IncProjectBuilder.build(IncProjectBuilder.java:183) at org.jetbrains.jps.cmdline.BuildRunner.runBuild(BuildRunner.java:132) at org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:302) at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:132) at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler.lambda$channelRead0$0(BuildMain.java:219) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748)
  bc24a51580c94e79b1a50b4e3cbf7e03 Maven没什么问题,就是一直编译有问题,build project也不行,构建不通过。

解决办法:

Setting -->Build,Execution,Deployment -->Compiler -->User-local build加上参数:
-Djps.track.ap.dependencies=false
这个解释我百度出来的结果是这样的:-Djps.track.ap.dependencies=false如果添加该选项,字段Build process VM options在调用 Filer 方法时禁用注释处理器指定的依赖项集合。 07a1507bba0d46a58b91c33dee7ba2b1 特此记录下,避免更多的人掉这个坑里面。
正文到此结束
Loading...