转至元
Eclipse、Intellij idea代码格式化结果不一样,如果开发同一个项目时可能会有代码格式上的冲突。要解决这个问题,idea和eclipse都需要调整下。下面是idea需要配置的操作,eclipse的操作见 IDEA和eclipse 格式化同步之eclipse。
1,安装插件Eclipse Code Formatter:
硬盘安装:Setting =>Plugins=>Install plugin from disk,选中安装包【EclipseFormatter.zip】安装,重启后生效;
EclipseFormatter.zip (在我资源里面下载)
2,配置插件:
选择Setting =>Other Settings =>Eclipse Code Formatter,勾选Use the Eclipse-code-formatter,并在Eclipse Java Formatter config file选择Eclipse用的xml文件,这个选项会决定格式化代码的方式。再选择Java formatter profile 为刚刚导入的文件。
Zhongan-Conventions.xml(在我资源里面下载)
3,安装save actions插件
参考: IDEA 自动格式化