Java 如何从 checkstyle 配置生成 Eclipse 格式化程序配置?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/984778/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to generate an Eclipse formatter configuration from a checkstyle configuration?
提问by Ken Liu
I have a checkstyle configuration XML file and want to automatically generate an Eclipse formatter configuration from this. Is there any tool that can do this?
我有一个 checkstyle 配置 XML 文件,并希望由此自动生成一个 Eclipse 格式化程序配置。有什么工具可以做到这一点吗?
采纳答案by Paul
In Eclipse (3.6):
在 Eclipse (3.6) 中:
- Install Checkstyle plug-in
- Import stylesheet using Windows --> Preferences, General --> Checkstyle --> New. Since you have an external file, choose "external file" as the type.
- 安装Checkstyle 插件
- 使用 Windows --> Preferences, General --> Checkstyle --> New 导入样式表。由于您有一个外部文件,请选择“外部文件”作为类型。
Right-click on your project in the Package view and select Checkstyle --> Create Formatter-Profile.
在 Package 视图中右键单击您的项目并选择 Checkstyle --> Create Formatter-Profile。
Then enable the formatter for your workspace: Windows --> Preferences --> Java --> Code Style --> Formatter. Select formatter: "eclipse-cs [project name]".
然后为您的工作区启用格式化程序:Windows --> 首选项 --> Java --> 代码样式 --> 格式化程序。选择格式化程序:“eclipse-cs [项目名称]”。
Click OK!
点击确定!
回答by Andreas Dolk
Herethey say, that you can import a checkstyle configuration directly into the eclipse formatter. Didn't verify, but at least, it's a hint.
他们在这里说,您可以将 checkstyle 配置直接导入到 eclipse 格式化程序中。没有验证,但至少,这是一个提示。
If the link doesn't work in your browser, please copy'n'paste this url: http://dbestudio.wiki.sourceforge.net/Code+Formatting+with+Checkstyle
如果链接在您的浏览器中不起作用,请复制'n'粘贴此网址:http://dbestudio.wiki.sourceforge.net/Code+Formatting+with+Checkstyle