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
I am very happy to announce the first version of the MapStruct IntelliJ IDEA plugin. Now we have official support for 2 IDEs, Eclipse being the first IDE for which we had support from earlier (plugin here ). With the power of IntelliJ you now get completions in @Mapping and @ValueMapping annotations (also for nested mappings ;)).
With this plugin we are bringing first class support for MapStruct within IntelliJ and addressing long lasting requests from users for the support (such as mapstruct#520 and IDEABKL-7174 ). Some of the new features:
After you’ve cloned you can import it by selecting “File -> Import Module …” and then selecting the top level aggregator pom.xml file located in the root folder. IDEA then will load MapStruct, resolve all dependencies and compile the source. You might face an error on IDEAs Message tab saying
If so, open the preferences window, navigate to Compiler -> Annotation processor and untick checkbox “Enable annotation processing” at “Annotation profile for mapstruct-integrationtest”. You should now be able to rebuild MapStruct.
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
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With