解決ClassNotFoundException: Cannot find implementation for xxx?(環境:Mapstruct、Lombok、Maven 和 Eclipse)


一、環境:

Eclipse version:2021-06. ( lasted version)
lombok version:1.18.20 ( lasted version)
m2e-apt:1.5.3 ( lasted version)

二、安裝好m2e-apt plugin 好,進行配置

 

三、pom配置:

 <properties>
        <!-- automatically run annotation processors within the incremental compilation -->
          <m2e.apt.activation>jdt_apt</m2e.apt.activation>
    </properties>
       <dependency>
            <groupId>org.mapstruct</groupId>
            <artifactId>mapstruct-jdk8</artifactId>
            <version>${mapstruct.version}</version>
        </dependency>
        <dependency>
            <groupId>org.mapstruct</groupId>
            <artifactId>mapstruct-processor</artifactId>
            <version>${mapstruct.version}</version>
        </dependency>

不建議有

<!-- <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
<annotationProcessorPaths>
<path>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>${mapstruct.version}</version>
</path>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</path>
</annotationProcessorPaths>
</configuration>
</plugin> -->

 

 參考鏈接:

https://github.com/mapstruct/mapstruct/issues/2527


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM