Abderrahim
Abderrahim

Reputation: 663

I can't generate getters and setters with lombok

I am developing a gradle project please take a look at my 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')
}

I am using eclipse neon. I refresh gradle project but It's not generate getters and setters for my entities.

like :

@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;
}

When use Eclipse's shortcut Ctrl + O for search of methods and fields in a class I don't see the getters and setters of my class UserEntity Please do you have an idea ?

Upvotes: 1

Views: 3691

Answers (3)

Błażej Kocik
Błażej Kocik

Reputation: 1699

For IntelliJ enable AnnotationProcessors:

Settings > Build, Execution, Deployment > Compiler > Annotation Processors > Enable annotation processing

Upvotes: 3

Michael Piefel
Michael Piefel

Reputation: 19998

You need to install the Lombok plugin for Eclipse in order to see generated code within the IDE. The easiest way is to use the installer contained in any lombok.jar (even the ones found in your local Maven or Gradle cache); it is an executable JAR.

Upvotes: 2

Abderrahim
Abderrahim

Reputation: 663

I found a solution I downloaded lombo jar and double click on it for install it then I restarted my eclipse finally cleaned my project

Upvotes: -1

Related Questions