Catalogue [-]
- Method
- To install the plugin:
- To configure the plugin:
- Using plugins
- Test
It is important for a team to use a unified code format, or there will be a lot of conflicts when using the version Control tool. In eclipse, we can use some XML for the unification of code format, but these files should be used in the IntelliJ, still need a little bit of trouble. But if you're like a blogger, having a painful experience of merging a file with 200 conflicts, you'll find the job worthwhile.
Method
Generally we use eclipse to unify the code-style.xml
files. IntelliJ cannot import this file directly, but there is a plugin that Eclipse Code Formatter
can accomplish this task.
- To install the plugin:
Select Preferences=>plugins=>browse repositories, search Eclipse to appear, click Install in the upper left corner Download and Install
. After installation, restart IntelliJ to locate the configuration item in Preferences=>eclipse Code formatter.
- To configure the plugin:
Select Preferences=>eclipse code Formatter, tick Use the Eclipse-code-formatter
, and select the Eclipse Java Formatter config file
file for Eclipse code-style.xml
, this option determines how the code is formatted. Also configured Import order
From File
for Eclipse code-style.xml
files, this option determines how the import area is organized.
- Using plugins
Use the IntelliJ format shortcut "ctrl+shift+f" to format. If an error occurs, the output prompts to the event log, and if you see ' xxx formatted sucessfully by Eclipse code Formatter ' then the format is successful!
To add a little tip, it is generally recommended that you only format your own code, do not format the full file, select your own block of code, and then use "ctrl+shift+f" to partially format it.
- Test
Bloggers are tested in IntelliJ IDEA12 and Eclipse Code Formatter
use a code-template.xml with Eclipse 3.5 to edit the same file without a conflict.
IntelliJ using--Import the code format file for Eclipse