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 is 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.
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.
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.