Eclipse CheckStyle

百般思念 提交于 2019-12-12 04:33:02

问题


Recently I added a new checkstyle (XML) file in Eclipse.

After I ran mvn checkstyle:checkstyle, I saw a bunch of checkstyle errors in A.java.

Then, in Eclipse, I right-clicked A.java, and picked "Apply Checkstyle Fixes." However, no changes were made.

Please advise me on how to apply my checkstyle changes.

Note: I do not have Eclipse configured to build. I only use it for changing code, and then I build using maven on the command-line.

Thanks


回答1:


I don't know what Eclipse plugin you use, but I use eclipse-cs.

In eclipse-cs, when you write a CheckStyle Checker (a class for detecting CheckStyle-related issues), you can write another class as so-called quickfix. If the writer of a Checker does not provide a quickfix, none will be available to you.

As for the maven issue, where your maven output and Eclipse warnings differ: The configuration of Eclipse may differ from the configuration read by maven. Please make sure both use the same configuration file.




回答2:


You have to fix your checkstyle warnings manually.



来源:https://stackoverflow.com/questions/12821683/eclipse-checkstyle

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!