简体   繁体   中英

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

After upgrading to the version 2020.3 of Idea i get a NullPointerException for the mapping processor. If anybody has a clue... Thank you!

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.

If you cannot update MapStruct (my case), details here .

You have to find the exact place where put the -Djps.track.ap.dependencies=false setting (and I had hard time to figure out where).

So, as they say, a picture is worth a thousand words在哪里放 ps.track.ap.dependencies=false

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>

Expanding on freedev's answer. For windows users the following will be the place to go:

  1. Click on the settings gear icon on the right. 在此处输入图像描述
  2. Go to settings (ctrl+A+S is a good shortcut to get here).
  3. Find Compiler under Build,Execution, Deployment in the left menu 在此处输入图像描述
  4. Add -Djps.track.ap.dependencies=false in User-local build process VM options

In my case, I made these changes and it works perfectly for me.

在此处输入图像描述

在此处输入图像描述

Then I just deleted the caches and rebuilt the entire project, maybe it wasn't necessary but that worked for me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM