'Compilation error: duplicate class with MapStruct in IntelliJ IDEA 2019.1

I am using Mapstruct for mapping between different Java Beans, but after installing the latest IntelliJ update, Compilation is getting failed with error:

Compilation error: duplicate class

Here are the version details of IntelliJ

IntelliJ IDEA 2019.1 (Ultimate Edition)
Build #IU-191.6183.87, built on March 27, 2019
JRE: 1.8.0_202-release-1483-b39 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.14.3

Compilation Error :

Error:(14, 8) java: duplicate class: com.company.mapper.GMapperImpl


Solution 1:[1]

.out directory was causing this problem, I deleted it and it started working fine

Solution 2:[2]

I was facing similar issue for my classes and it got resolved by performing maven clean from inside intellij by clicking on clean lifecycle phase on maven project where this error is coming and then build the project again from intellij.

enter image description here

Solution 3:[3]

Try deleting the .java file if it already exists in the original package and if you copied in a previous run and then run and a new copy will be found under the target folder and this will eliminate the duplicate class error. Even if the error appears it still doesn't hurt since the new class will always be generated under target -> generated-sources->annotation folder. Once you copy this over and delete the copy under target folder you should be good.

Solution 4:[4]

In my case (a multi module project) it was because the project configuration messed up: in the module configuration (F4) there was a second source root pointing to the master pom. Removing that was enough.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Neeraj Jain
Solution 2 Anshul Singhal
Solution 3 user1419261
Solution 4 Ronald van Uffelen