简体   繁体   中英

Lombok: Data cannot be resolved to a type

I have downloaded the Lombok.jar from the official website . I have double clicked on it and made sure it is installed on my STS . Then i have added the dependency into my pom.xml :

       <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok-maven</artifactId>
            <version>1.16.18.0</version>
            <type>pom</type>
        </dependency>

and then i have the below class:

@Data
@Entity
public class Kinkester {


    @Id
    @GeneratedValue
    Long id;

    int age;

}

but in the line @Data it complains with:

Data cannot be resolved to a type

So, it seems that it does not identify the lombok?

I have restarted my Eclipse, and cleaned the project, and updated the maven, but still not working.

That is the wrong import, what you want is,

<dependency>
    <groupId>org.projectlombok</groupId>
    <artifactId>lombok</artifactId>
    <version>1.16.16</version>
    <scope>provided</scope>
</dependency>

你需要lombok罐子而不是lombok-maven

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM