title: Mapstruct and InteliJ - Exception sometimes with inherited fields during `build project`
body: <h2>Problem:</h2>
  
  <p>We have a class that extends another class and inherits some fields.
  <code>clean install</code> in maven is working perfectly and the <code>impl</code> mapper classes are being generated.</p>
  
  <p>Sometimes other people (students, etc) have changed the mappers, I notice that the <code>build/make project</code> in InteliJ is breaking.</p>
  
  <p>I am getting an error such as the following stacktrace:</p>
  
  <pre><code>    Error:(12, 8) java: Internal error in the mapping processor: java.lang.NullPointerException            at
   org.mapstruct.ap.internal.model.source.SourceReference.copyForInheritanceTo(SourceReference.java:333)  at
   org.mapstruct.ap.internal.model.source.Mapping.copyForInheritanceTo(Mapping.java:462)      at
   org.mapstruct.ap.internal.model.source.MappingOptions.applyInheritedOptions(MappingOptions.java:279)     at
   org.mapstruct.ap.internal.processor.MapperCreat
  ionProcessor.mergeInheritedOptions(MapperCreat
  ionProcessor.java:457)                  at
   org.mapstruct.ap.internal.processor.MapperCreat
  ionProcessor.getMappingMethods(MapperCreat
  ionProcessor.java:274)                  at
   org.mapstruct.ap.internal.processor.MapperCreat
  ionProcessor.getMapper(MapperCreat
  ionProcessor.java:152)                  at
   org.mapstruct.ap.internal.processor.MapperCreat
  ionProcessor.process(MapperCreat
  ionProcessor.java:123)                  at
   org.mapstruct.ap.internal.processor.MapperCreat
  ionProcessor.process(MapperCreat
  ionProcessor.java:80)                  at
   org.mapstruct.ap.MappingProcessor.process(MappingProcessor.java:280)    at
   org.mapstruct.ap.MappingProcessor.processMapperTypeElement(MappingProcessor.java:260)              at
   org.mapstruct.ap.MappingProcessor.processMapperElements(MappingProcessor.java:226)      at
   org.mapstruct.ap.MappingProcessor.process(MappingProcessor.java:162)         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.processAnnotat
  ions(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
  </code></pre>
  
  <p>And here is where jetbrains part is:</p>
  
  <pre><code> org.jetbrains.jps.javac.JavacMain.compile(JavacMain.java:190)                 at
   org.jetbrains.jps.incremental.java.JavaBuilder.compileJava(JavaBuilder.java:483)             at
   org.jetbrains.jps.incremental.java.JavaBuilder.compile(JavaBuilder.java:339)     at
   org.jetbrains.jps.incremental.java.JavaBuilder.doBuild(JavaBuilder.java:256)      at
   org.jetbrains.jps.incremental.java.JavaBuilder.build(JavaBuilder.java:214)           at
   org.jetbrains.jps.incremental.IncProjectBuilder.runModuleLevelBuilders(IncProjectBuilder.java:1263)  at
   org.jetbrains.jps.incremental.IncProjectBuilder.runBuildersForChunk(IncProjectBuilder.java:940)            at
   org.jetbrains.jps.incremental.IncProjectBuilder.buildTargetsChunk(IncProjectBuilder.java:1012)               at
   org.jetbrains.jps.incremental.IncProjectBuilder.buildChunkIfAffected(IncProjectBuilder.java:903)           at
   org.jetbrains.jps.incremental.IncProjectBuilder.buildChunks(IncProjectBuilder.java:736)              at
   org.jetbrains.jps.incremental.IncProjectBuilder.runBuild(IncProjectBuilder.java:384)      at
   org.jetbrains.jps.incremental.IncProjectBuilder.build(IncProjectBuilder.java:192)             at
   org.jetbrains.jps.cmdline.BuildRunner.runBuild(BuildRunner.java:138)                  at
   org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:295)                  at
   org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:125)            at
   org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler.lambda$channelRead0$0(BuildMain.java:236)               at
   org.jetbrains.jps.service.impl.SharedThreadPoolImpl.lambda$executeOnPooledThread$0(SharedThreadPoolImpl.java:42)                  at
   java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)       at
   java.util.concurrent.FutureTask.run(FutureTask.java:266)            at
   java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)     at
   java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)     at
   java.lang.Thread.run(Thread.java:745)  
  </code></pre>
  
  <h2>Question:</h2>
  
  <p>So, is there some type of configuration change I need to make to InteliJ???</p>
  
  <h2>Current Workaround:</h2>
  
  <p>What is working for me now, is to go to the <code>Spring Boot Run Configuration</code> and in the section <code>Before Launch: Activate tool window</code> I have made a change.</p>
  
  <p>I have removed <code>Build Project</code>. So the <code>target directory</code> generated from maven is used. Inteli J make command is used only to rebuild and hotswap changed classes.</p>