IntelliJ Idea mapstruct java: Internal error in the mapping processor: java.lang.NullPointerException

The solution is to update MapStruct to 1.4.1.Final or later version, see this issue for more details.

You can also add -Djps.track.ap.dependencies=false at File | Settings (Preferences on macOS) | Build, Execution, Deployment | Compiler | Build process VM options as a workaround.


There are several intellij bugs here. If I change the maven version 1.3.0.Final to 1.4.1.Final the intellij don't want to update the version.

Solution

  1. Upgrade the maven version to 1.4.1.Final
  2. Delete manually mapstruct 1.3.1.Final from External Libraries(Project Structure | Libraries)
  3. mvn clean package
  4. Click reload all maven projects

It works without -Djps.track.ap.dependencies=false

If you have swagger exclude mapstruct first:

<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>${swagger2.version}</version>
<exclusions>
    <exclusion>
        <groupId>org.mapstruct</groupId>
        <artifactId>mapstruct</artifactId>
    </exclusion>
</exclusions>