簡介:統一代碼格式包含編碼、格式化
基於阿里代碼規範,官方地址:https://github.com/alibaba/p3c/tree/master/p3c-formatter
1. 格式化模板導入
· 依次點擊:Window->Preferences->Java->Code Style->Formatter->Import
· 選擇jiupi-codetemplates.xml文件確定
· 默認在Active profile中選擇新導入的P3C-CodeStyle,如未選擇,請手動選 擇
· 點擊Apply完成配置
2. 註釋模板導入
· 操作流程同上,Window->Preferences->Java->Code Style->Code Templates->Import
· 勾選Automatically add comments for new methods and types
· 點擊Apply完成配置
3. 文件編碼
· Window->Preferences->General->Content Types->Text->Java Properties File
· 將Java Properties File及下屬的所有項均設定為 Default encoding: UTF-8
閱讀更多 小哥哥愛學習 的文章