【eclipse tab键设置】gradle项目编译错误:[ant:checkstyle] [ERROR] Line contains a tab character.

前言

创作开始时间:2021年3月15日14:56:28

如题。gradle项目运行时碰到这个问题:

> Task :gen.jdt:checkstyleMain FAILED
[ant:checkstyle] [ERROR] /xxx/gumtreediff/gen/jdt/JdtVisitor.java:101:9: Line contains a tab character. [FileTabCharacter]
[ant:checkstyle] [ERROR] /xxx/gumtreediff/gen/jdt/JdtVisitor.java:102:9: Line contains a tab character. [FileTabCharacter]

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':gen.jdt:checkstyleMain'.
> Checkstyle rule violations were found. See the report at: file:///xxx/gumtree/gen.jdt/build/reports/checkstyle/main.html
  Checkstyle files with violations: 1
  Checkstyle violations by severity: [error:2]

本文给出解决方案。

正文

第一步

我的项目是在eclipse中修改的,所以在eclipse中做下图修改:
上方菜单栏->Windows->Preferences->General->Editors->Text Editors-> Insert spaces for tabs
在这里插入图片描述

第二步

同样,在preferences的Java -> Formatter 栏新建一个 Formatter,(我命名成了dale_code_style),然后修改Indentation为spaces only.然后确认,应用即可。如下图。

在这里插入图片描述

在这里插入图片描述

重新编译

此时终于没错误了。

小结

以上。参考文献一开始没找对,硬是没解决问题。

不过也学到了知识,从这篇博客:

创作结束时间:2021年3月15日15:18:20

参考文献

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值