问题
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