1:安裝eclipse-code-formatter
打開IntelliJ IDEA 2019.3開發工具,選擇菜單File->Settings->Plugins,搜索Eclipse Code Formatter點擊安裝。
2:導入代碼格式化樣式(導入alibaba-codestyle.xml)
alibaba-codestyle.xml 文件地址:https://files-cdn.cnblogs.com/files/barry-blog/alibaba-codestyle.xml
3:設置idea保存時自動格式化
搜索Save Actions點擊安裝。(同步驟1)
設置Save Actions
4:設置java class文件模板
設置創建class文件模板,創建class類時默認自帶內容。
5:安裝alibaba代碼規范
搜索Alibaba Java Coding Guidelines點擊安裝。(同步驟1)