簡體   English   中英

我無法使用龍目島生成吸氣劑和二傳手

[英]I can't generate getters and setters with lombok

我正在開發gradle項目,請查看我的build.gradle

buildscript {
    ext {
        springBootVersion = '1.5.7.RELEASE'
    }
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
    }
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'

group = 'com.support.wizard'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8

repositories {
    mavenCentral()
}

def swaggerVersion = "2.7.0"

dependencies {
    compile('org.springframework.boot:spring-boot-starter-data-jpa')
    compile('org.springframework.boot:spring-boot-starter-data-rest')
    compile('org.springframework.boot:spring-boot-starter-web')
    compile('org.springframework.boot:spring-boot-starter-security')
    compile('org.springframework.security.oauth:spring-security-oauth2')
    compile('org.springframework.integration:spring-integration-mail')
    compile group: 'com.sun.mail', name: 'javax.mail', version: '1.5.2'
    compile ("io.springfox:springfox-swagger2:${swaggerVersion}")
    compile ("io.springfox:springfox-swagger-ui:${swaggerVersion}")
    compile("mysql:mysql-connector-java:6.0.6")
    compileOnly('org.projectlombok:lombok')
    testCompile('org.springframework.boot:spring-boot-starter-test')
}

我正在使用日食霓虹燈。 我刷新gradle項目,但它沒有為我的實體生成getter和setter。

喜歡 :

@Entity
@Table(name = "users")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class UserEntity {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    private String email;

    private String username;

    private String password;

    private String phoneNumber;

    private String role;

    private String resetToken;

    private boolean enabled;
}

當使用Eclipse的快捷鍵Ctrl + O搜索類中的方法和字段時,我看不到類UserEntity的getter和setters。

您需要安裝用於Eclipse的Lombok插件才能在IDE中查看生成的代碼。 最簡單的方法是使用任何lombok.jar包含的安裝程序(甚至可以在本地Maven或Gradle緩存中找到的安裝程序); 它是一個可執行的JAR。

對於IntelliJ,啟用AnnotationProcessors:

設置>構建,執行,部署>編譯器>注釋處理器> 啟用注釋處理

我找到了一個解決方案,我下載了lombo jar,然后雙擊安裝它,然后重新啟動Eclipse,最終清理了我的項目

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM