Lombok的IntelliJ IDEA编译错误

在佩里斯:

我有一个使用集成开发环境IntelliJ IDEA的Lombok的SpringBoot项目,带有以下对象:

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@JsonInclude(NON_NULL)
@Entity
@Table(name = "t_user_role")
public class UserRole implements Serializable {



    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @JsonIgnore
    private Long id;
    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "user_id")
    @JsonIgnore
    private User user;
    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "role_id")
    private Role role;


}

还有这个对象:

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@JsonInclude(NON_NULL)
@Entity
@Table(name="t_user")
public class User implements Serializable, UserDetails {

..

    @Override
    @JsonIgnore
    public Collection<? extends GrantedAuthority> getAuthorities() {
        Set<GrantedAuthority> authorities = new HashSet<>();
        userRoles.forEach(ur -> authorities.add(new Authority(ur.getRole().getName())));
        return authorities;
    }

..
}

但我有一个编译错误:

在此处输入图片说明

但是当我使用Maven编译项目时,一切都很好

user404:

只需安装lombok插件并重新启动IDEA,希望能起作用。您可以按照以下步骤操作:

  1. 转到文件>设置>插件
  2. 单击浏览存储库
  3. 搜索龙目岛
  4. 点击安装插件
  5. 重新启动IntelliJ IDEA
  6. 清洁建设项目
  7. 如果仍然无法使用,请转到“ 文件” 无效的缓存/重启

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

IntelliJ IDEA的Lombok @RequiredArgsConstructor(onConstructor_ = {@MyAnnotation})编译错误

使用 Lombok 和 IntelliJ 时出现奇怪的编译错误

编译错误-Groovy和Lombok

Java 1.8和IntelliJ IDEA 14中注释的编译错误

IntelliJ IDEA:运行单个类,而忽略其他类中的编译错误

如何立即查看IntelliJ Idea项目树中的编译错误?

在编辑器中的IntelliJ-idea中显示编译错误

发生编译错误时,如何防止 Intellij Idea 在打开的文件之间切换?

Lombok插件与2018.1 Intellij Idea不兼容

IntelliJ IDEA无法看到Lombok生成的代码

IntelliJ 14 + Lombok插件+ @Builder =错误

如何在IntelliJ中查看编译错误列表?

为什么Hibernate查询在IntelliJ中有编译错误?

SpringApplication.run intellij中的编译错误

IntelliJ入门示例给出了编译错误

Lombok IntelliJ中的编译问题-Mac,已启用注释

Lombok中的Val在IntelliJ中产生“不兼容类型”错误,但仍可正常编译

在子类的构造函数上使用时,lombok @Builder(toBuilder = true)编译错误

mvn install 为 Lombok 属性的 @Getter @Setter 属性产生编译错误

使用Intellij Idea编译Aurelia的打字稿错误

在IntelliJ中运行JUnit,而忽略无关类中的编译错误?

如何在Intellij中获取有关编译错误的建议

IntelliJ 在 Groovy 应用程序中使用 RxJava fromCallable() 方法编译错误?

Intellij中的模拟不会忽略模拟类中的编译错误吗?

使用Maven时Intellij上Spark(DataTypeConversions.scala)中的编译错误

Lombok IntelliJ IDEA插件:默认情况下,禁用var的使用

如何在Lombok生成的IntelliJ IDEA中的setter方法中设置断点?

添加了Lombok,但是在Intellij IDEA中无法识别吸气剂和吸气剂

如果我无法安装插件,如何在IntelliJ Idea中安装lombok