IDEA下使用Lombok时无法编译项目

IDEA下使用Lombok时无法编译项目

本文介绍了当我在IntelliJ IDEA下使用Lombok时无法编译项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在我使用IntelliJ IDEA 11开发的项目中使用。

I'm trying to use Lombok in my project that I'm developing using IntelliJ IDEA 11.

我已经安装了而且似乎工作正常,因为IDEA会看到所有自动生成的方法/字段。

I've installed 3rd-party plugin for IDEA and it seems working fine because IDEA sees all autogenerated methods/fields.

所以我有一个使用Slf4j的类。我这样注释了它

So I have a class that uses Slf4j. I annotated it like this

import lombok.extern.slf4j.Slf4j;

@Slf4j
public class TestClass
{
    public TestClass()
    {
        log.info("Hello!");
    }
}

但是当我构建我的项目时,编译器吐出:找不到符号变量log

But when I build my project compiler spits: cannot find symbol variable log.

你能否告诉我这里缺少什么?

Could you please tell me what I'm missing here ?

更新:原来,它的RequestFactory注释流程失败。

Update: It turned out it's RequestFactory annotation process that fails.

input files: {com.zasutki.courierApp.server.TestServlet, com.mine.courierApp.server.model.DatastoreObject}

annotations: [javax.inject.Singleton, javax.inject.Inject, lombok.Getter, lombok.Setter, com.googlecode.objectify.annotation.Id, com.googlecode.objectify.annotation.OnSave]

Processor com.google.web.bindery.requestfactory.apt.RfValidator matches [lombok.Getter, com.googlecode.objectify.annotation.Id, javax.inject.Inject, lombok.Setter, com.googlecode.objectify.annotation.OnSave, javax.inject.Singleton] and returns false.

cannot find symbol variable log

有关解决方法的任何想法吗?

Any ideas on workarounds ?

Update2:也许这不是读者想要听到的东西但我最终切换到。

Update2: Perhaps it's not something readers want to hear but I ended up switching to Scala.

推荐答案

我已修复它IDEA 12设置复选框启用注释处理 in:

I have fixed it in IDEA 12 by setting check box Enable annotation processing in:

对于IDEA 2016.2:

For IDEA 2016.2:

这篇关于当我在IntelliJ IDEA下使用Lombok时无法编译项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-01 23:32