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>
posted @ 2021-08-19 17:32  小小记录本  阅读(123)  评论(0编辑  收藏  举报