IntelliJ IDEA无法看到Lombok生成的代码 [英] IntelliJ IDEA cannot see Lombok generated code

查看:1007
本文介绍了IntelliJ IDEA无法看到Lombok生成的代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用lombok的基于Gradle的项目。我已将此项目导入IntelliJ IDEA 14.1(使用导入外部模型导入方法)。我可以在Gradle中没有问题地运行JUnit4单元测试,但IntelliJ似乎在看到Lombok生成的Getters时遇到了问题。这使我无法在IDEA中运行测试。



为了确保它不是设置问题,我创建了一个。



另外你应该安装lombok插件,如果还没有完成


I have a Gradle-based project that uses lombok. I have imported this project into IntelliJ IDEA 14.1 (using the Import External Model import method). I can run the JUnit4 unit tests without problem in Gradle, but IntelliJ seems to have a problem seeing the Lombok generated Getters. This is preventing me from running the tests in IDEA.

To make sure it wasn't a set up issue, I created a Very simple project and confirmed that the same issue occurs in the simple test project.

My versions: Gradle: gradle-2.3-all via Gradle wrapper
Intellij IDEA: IU-141.713
Lombok Plugin: 0.9.2

What am I missing here?

Update By cannot see I don't mean physically invisible. I mean this:

/home/meeee/workspace/junit-lombok-idea/lib/src/main/java/com/example/jumbokea/Main.java
Error:(10, 11) java: cannot find symbol
  symbol:   method setIntField(int)
  location: variable sc of type com.example.jumbokea.SomeClass
Error:(12, 41) java: cannot find symbol
  symbol:   method getIntField()
  location: variable sc of type com.example.jumbokea.SomeClass
Error:(14, 33) java: constructor AnotherClass in class com.example.jumbokea.AnotherClass cannot be applied to given types;
  required: no arguments
  found: float,com.example.jumbokea.SomeClass
  reason: actual and formal argument lists differ in length
Error:(16, 46) java: cannot find symbol
  symbol:   method getSomeFloat()
  location: variable ac of type com.example.jumbokea.AnotherClass
Error:(17, 43) java: cannot find symbol
  symbol:   method getSomeClass()
  location: variable ac of type com.example.jumbokea.AnotherClass

The decompiled classes show the getters and setters, but I'm getting these errors when I get IntelliJ to run the 'app' or the Unit tests.

解决方案

You need to enable the annotation preprocessor. See documentation here.

Additionally you should install the lombok plugin if not done already

这篇关于IntelliJ IDEA无法看到Lombok生成的代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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