Jhispter不能使用Lombok解决方案

时间:2021-08-19
本文章向大家介绍Jhispter不能使用Lombok解决方案,主要包括Jhispter不能使用Lombok解决方案使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

原解决方案

简而言之

jhipster在pom文件中指定了注解处理器annotationProcessorPaths,没有增加lombok作为注解处理器,因此我们手动添加lombok即可

原来

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
    <annotationProcessorPaths>
        <path>
            <groupId>org.mapstruct</groupId>
            <artifactId>mapstruct-processor</artifactId>
            <version>${mapstruct.version}</version>
        </path>
        <!-- For JPA static metamodel generation -->
        <path>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-jpamodelgen</artifactId>
            <version>${hibernate.version}</version>
        </path>
    </annotationProcessorPaths>
</configuration>

修改后

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
    <annotationProcessorPaths>
        <path>
            <groupId>org.mapstruct</groupId>
            <artifactId>mapstruct-processor</artifactId>
            <version>${mapstruct.version}</version>
        </path>
        <!-- For JPA static metamodel generation -->
        <path>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-jpamodelgen</artifactId>
            <version>${hibernate.version}</version>
        </path>
        # 增加lombok处理器
        <path>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>1.16.18</version>
        </path>
    </annotationProcessorPaths>
</configuration>

原文地址:https://www.cnblogs.com/xiaojiluben/p/15162908.html