Hi,
I am using mapstruct as part of my spring boot application(java 1.8) to map DTO to entities.I have been facing two issues,
issue 1 : Could not retrieve @Mapper annotation error at compilation time.
I found solution somewhere in the forum as exclude mapstruct from springfox-swagger2 dependency like below
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<exclusions>
<exclusion>
<artifactId>org.mapstruct</artifactId>
<groupId>mapstruct</groupId>
</exclusion>
</exclusions>
</dependency>
what is the reason to exclude mapstruct from springfox-swagger2 and also do we have any solution other than excluding in the pom?
issue2: Mapper implementation classes could not be generated if maven-compiler-plugin is not provided.
I have plug in configuration like below in my pom file.As it is a spring boot application didn't provide version as it is managed by spring boot automatically,but if i don't provide version(3.5.1)for maven-compiler-plugin,mapper implementation classes are not getting generated.Classes are getting generated only when version 3.5.1 is provided.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<encoding>${project.build.sourceEncoding}</encoding>
<annotationProcessorPaths>
<path>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>${org.mapstruct.version}</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
Thanks,
shekar