STS v. 4.14.1.RELEASE
Java v. 11
Spring Boot v. 2.6.7
MapStruct v. 1.5.1
I'm testing MapStruct functionalities and I've found myself in a very frustrating yet apparently basic problem which I'm not being able to solve for some hours now.
Once added the MapStruct dependencies and plugin to the project as supposed:
<properties>
<java.version>11</java.version>
<org.mapstruct.version>1.5.1.Final</org.mapstruct.version>
</properties>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct</artifactId>
<version>${org.mapstruct.version}</version>
</dependency>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>${org.mapstruct.version}</version>
</path>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</path>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok-mapstruct-binding</artifactId>
<version>0.2.0</version>
</dependency>
</annotationProcessorPaths>
<compilerArgs>
<compilerArg>
-Amapstruct.defaultComponentModel=spring
</compilerArg>
</compilerArgs>
</configuration>
</plugin>
MapStruct is supposed to auto generate the MapperImpl in the same package where the mapper interface is implemented, under the root folder 'target/generated-sources/annotations' and it does it perfectly.
The problem is STS/Eclipse marks the generated MapperImpl class with an error 'The type XMapperImpl is already defined'.
I've search everywhere in the project - both mine and auto-generated classes - and there is not such another class with the same name - actually it is the only mapper interface in the whole project-, so I don't understand how can it be already defined.
I've also cleaned the project several times, re-built it... Anything I can think of in order to clean whatever could be interfering with this class and every time the project generates the XMapperImpl, STS marks it with the same error.
At this point I am wondering whether there is something I might be overlooking or perhaps some bug in the STS/Eclipse?
Update: I'm pretty sure it has to be some kind of cache, because even if I delete the source file of the mapper, when updating the Maven project, the mapper implementation keeps on appearing in the auto-generated files. I still don't understand where it is being cached though.