map struct :- Caused by: org.apache.maven.plugin.compiler.CompilationFailureException: Compilation failure

Some times while integrating map-struct with spring boot/swagger we will get below exception:-



[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project : Compilation failure
[ERROR]  Couldn't retrieve @Mapper annotation



Solution:-

You don't need to exclude the entire swagger for this. You can do this to only exclude the Mapstruct dependency that swagger2 brings with itself:


<dependency>
    <groupId>io.springfox</groupId>
    <artifactId>springfox-swagger2</artifactId>
    <version>${swagger2.version}</version>
    <exclusions>
        <exclusion>
            <groupId>org.mapstruct</groupId>
            <artifactId>mapstruct</artifactId>
        </exclusion>
    </exclusions>
</dependency>

Comments

Popular posts from this blog

How to reset to previous commit.

Running docker as non-root user