Being a long time Eclipse user I recently started using IntelliJ. Here are some notes on how I use it for Java and Kotlin. I will probably update this post continuously.
Here are some of the topics that I thought were most interesting when doing the switch.
Free and Open Source
I don't want to depend on software that is not free and open source. That, to me, feels like a trap and something I want to avoid.
This is totally fine for me. Less is more!
I want to automatically have my IDE setup exactly how I want it and synchronize that to all my installations. Avoiding the time consuming task of searching for settings and clicking checkboxes.
In Eclipse I use Workspace Mechanics. The mechanics files are put under version control so that all developers of a project will have changes applied immediately when someone changes the settings.
In IntelliJ this is built in. In the menu, File -> Settings Repository you can add any git-repository. I just created a new repository on GitHub and is now using that clone URL. To publish settings you do File -> Settings Repository and click Merge.
I have seen that some settings are not synchronized when using IntelliJ. I really miss automatically download sources and documentation and most annoyingly is the option to optimize imports on the fly.
Opening Several Projects In Same Window
In Eclipse you would create a workspace and import projects in that workspace.
In IntelliJ you create a project and add modules to it. A module can be a Maven, or Gradle, project. You do:
- File -> New -> Project ...
- Empty project
- Name it anything you like
Now to add a Gradle project to it, you do:
- File -> New -> Module From Existing Sources...
- Select the build.gradle file. If it were Maven you would select the pom.xml file
Maintaining a Code Standard
In Eclipse you can setup save actions that will apply the code standard whenever a file is saved.
In IntelliJ I have not found any way of enforcing a code standard. It does a good job on understanding and adhering to how the current file already is formatted.
I always use an external tool for coder formatting, if I can find one. So that developers can use any editor. But sometimes I am not the maintainer of the project or other developers don't agree with me about doing it that way.
Automatically Boost Code Quality
In Eclipse I would setup save actions to automatically do things like:
- Remove unused variables
- Organize imports, sorting and removing unused imports
- Adding final keyword to immutable attributes and variables
- Remove trailing white space
In IntelliJ you can find these settings by simply searching in the settings menu (File -> Settings).
This will organize the imports when you are working with a file. You can also batch this by marking a folder in the menu and press CTRL-ALT-O.
In Eclipse I let Eclipse compile the code whenever I change anything. I immedely get clear feedback if any code does not compile.
I struggle with this in IntelliJ. It does not tell me about code that does not compile.
If I manually browse to a file that I know does not compile, and open it, IntelliJ will tell me it does not compile.
This is annoying as I keep getting compilation errors when building outside of IntelliJ which slows me down.
Reveal file in project view
In Eclipse I can reveal whatever file I open in the project view to the right.
It can be done in Intellij also.
Show projects and their parts
Eclipse does a really good job showing me projects and their parts. The project, source-folders, packages and files.
In IntelliJ I found flattern packages.
But it is not as clear as with Eclipse.
I am missing some features in IntelliJ regarding automatically correcting things in the code. But that is easily solved with Maven or Gradle. I wrote about that here.