当我在IntelliJ IDEA下使用Lombok时无法编译项目 [英] Can't compile project when I'm using Lombok under IntelliJ IDEA

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

问题描述

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

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

我已经安装了第三方插件对于IDEA 而且似乎工作正常,因为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:也许这不是读者想要听到的东西但我最终切换到 Scala

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:


设置 - >编译器 - >注释处理器

Settings -> Compiler -> Annotation Processors

对于IDEA 2016.2:

For IDEA 2016.2:


首选项...>构建,执行,部署>编译器>注释处理器

Preferences... > Build, Execution, Deployment > Compiler > Annotation Processors

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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆