lombokプラグインを使用した後、mapstructが有効にならない

背景:

springbootプロジェクトのlombokプラグインを使用した後、mapstructプラグインを追加します。mavenのコンパイル時にmapstructプラグインは機能しません。

 

急いで解決策を記録しましょう

1つの解決策:

以下の依存関係をpomファイルに追加します。著者が使用するmapstructのバージョンは1.3.0です。

 <!--  解决lombok插件和 mapstruct 冲突导致 mapstruct 不可用 -->
        <dependency>
            <groupId>org.mapstruct</groupId>
            <artifactId>mapstruct-processor</artifactId>
            <version>1.3.0.Final</version>
        </dependency>
        <dependency>
            <groupId>org.mapstruct</groupId>
            <artifactId>mapstruct-jdk8</artifactId>
            <version>1.3.0.Final</version>
        </dependency>
 
51件の元の記事を公開 Likes6 100,000以上を訪問

おすすめ

転載: blog.csdn.net/H_Rhui/article/details/105516280