EclipseCodeFormatter
IntelliJ plugin - use Eclipse's code formatter directly from IntelliJ. https://plugins.jetbrains.com/plugin/6546
Install / Use
/learn @krasa/EclipseCodeFormatterREADME
Adapter for Eclipse Code Formatter 
Allows using Eclipse's Java code formatter directly from IntelliJ. Solves the problem of maintaining a common code style in team environments where both IDEA and Eclipse are used.
Note: This project utilizes (and in some manners modifies) code licensed under EPL-2.0. For more information see lib/eclipse.
Instructions
- Install the plugin
- Configure it
- Configure Eclipse location (optional)
- Install Eclipse
- Got To IntelliJ Settings | Other Settings | Adapter for Eclipse Code Formatter
- Set
Eclipse installation folder(/Users/xxx/Eclipse.app/Contents/Eclipsefor Mac) - Change
Java formatter versiontoConfigured Eclipse installation folder
- Configure formatter
-
Either, export formatter profiles to get a
*.xmlfile- Go to
Eclipse | Windows | Preferences | Java | Code Style | Formatter - Eclipse does not export default profiles, so you have to make your own via the
Newbutton - Export the profile via the
Export all...button- The result should look like this
- Go to
-
Or, enable project specific formatter settings to get
org.eclipse.jdt.core.prefs- With your project open in Eclipse's workspace,
right-clickthe project and choose Properties - Go to
Java Code Style | Formatterand selectEnable project specific settings - Click
OKto save the settings - Go to the
.settingsdirectory inside your project's directory. There you will find theorg.eclipse.jdt.core.prefsfile which contains the Eclipse formatter settings- The result should look like this
- With your project open in Eclipse's workspace,
-
Or, export a Workspace Mechanic configuration to get a
*.epffile- The result should look like this
-
Open a project in IntelliJ
-
Set path to the config file via
IntelliJ | Settings | Other Settings | Adapter for Eclipse Code Formatter | Eclipse preference file -
When using exported profiles (the xml file), select desired profile in the combobox
Java formatter profile
-
- Check
Optimizing Importsconfiguration- Set import order
- Either, leave the default
- Or, set path to Eclipse configuration file:
- Go to
Eclipse | Windows | Preferences | Java | Code Style | Organize Imports- Either, click on
Export..., (example) - Or, enable project specific settings and use
org.eclipse.jdt.ui.prefsfile which should contain the lineorg.eclipse.jdt.ui.importorder=...
- Either, click on
- Go to
- Set the value of
Class count to use import withandName count to use static import withinSettings | Editor | Code Style | Java | Importsfor Idea 14 orSettings | Editor | Code Style | Importsfor older Idea. Eclipse uses 99 by default - For versions lower than 4.0 - make sure to disable IntelliJ's
Import Optimizingin the reformat dialog viaSettings | Editor | Show "Reformat Code" dialog. The plugin will take care of imports anyway - For versions higher than 4.0 - imports will be reordered together with normal IntelliJ's import optimizing
- Disable
Optimize imports on the fly
- Set import order
- Configure Eclipse location (optional)
- Format code as usual, notice the green bubble notification about successful formatting
- notifications can be disabled at
Settings | Notifications
- notifications can be disabled at
- Use
Ctrl + Alt + Oas usual, it will use this plugin - Use
Ctrl + ~for quick switch between formatters or icon at the main toolbar - Give it 5 stars
- Make a donation
Possible problems with Java formatting
@formatter:offis not working See: https://github.com/krasa/EclipseCodeFormatter/issues/64- Nothing was formatted or formatting failed
- Make sure you are using proper language level in
Main Menu | File | Project Structure
- Make sure you are using proper language level in
- Trailing spaces inside javadocs are stripped
- Set
Strip trailing spaces on savetoNone
- Set
- File is formatted differently
- The file is actually formatted fine, it just looks different in the editor, as the tab size and indendation are set differently in IntelliJ in
Settings | Editor | Code Style | Javathan in Eclipse. Using of either tab only or space only whitespace is recommended. - Or it is a bug
- The file is actually formatted fine, it just looks different in the editor, as the tab size and indendation are set differently in IntelliJ in
- Eclipse indendation is configured for 2 spaces, but a new line gets indented by 4 spaces when Enter is pressed.
- Change code style in IntelliJ. Not all things get formatted by this plugin when you type them.
- If nothing helps
- check old issues
- Create a new issue here
Troubleshooting
If it is mysteriously not working, go to Main Menu | Help | Edit Debug Settings and add:
krasa.formatter
Try to reformat something and create a new issue, including the log

YourKit supports open source projects with its full-featured Java Profiler. YourKit, LLC is the creator of YourKit Java Profiler and YourKit .NET Profiler, innovative and intelligent tools for profiling Java and .NET applications.
Related Skills
node-connect
347.9kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
108.7kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
347.9kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
347.9kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
