Eclipse保存代码自动格式化

首先放xml下载地址 https://share.weiyun.com/5i2UH8H (密码:Zk6g)

废话不多说 直接上图

.设置XML格式化模板

java文件,打开eclipse-->window--->preferences--->java-->Code Style-->Formater”,选择写好的模板.xml文件导入即可。

Eclipse保存代码自动格式化

.设置保存时自动格式化代码

        打开eclipse,选择 window-->Preferences-->JAVA-->Editor-->Save Actions。右边选中:Perform the selected actions on saveFormat source codeFormat all linesOrganize imports,保存后重启eclipse即可看到效果,操作步骤看下图:Eclipse保存代码自动格式化

ojbk完事!!!!