Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to migrate Inspection settings from Eclipse to Intellij?

In our company we have a strict list of Eclipse Error/Warning settings that must be used. Compiling our changes with this list, no Errors/Warnings should exist before checking in.

These Errors/Warnings can be found in Eclipse under Preferences -> Java -> Compiler -> Errors/Warnings. (Below is an example of some of the Eclipse settings, pls forgive the clipping at the bottom.)

I'm an IntelliJ user. IntelliJ has a similar concept called "Inspections". Inspection settings can be found under Settings -> Editor -> Inspections.

Does anyone know a way of migrating the Eclipse Errors/Warnings over the the closest possible match of IntelliJ inspection settings. I can see that there is a way to export/import the IntelliJ settings, but can't see any such functionality in Eclipse.

Any help would be appreciated.

PLEASE NOTE: This question is NOT about migrating "Code Style" settings between Eclipse and IntelliJ.

enter image description here

like image 617
Ben Avatar asked Jul 23 '15 09:07

Ben


People also ask

Can I Import Eclipse project into IntelliJ?

You can import either an Eclipse workspace or a single Eclipse project. To do this, click Open on the Welcome Screen or select File | Open in the main menu. IntelliJ IDEA automatically detects Eclipse projects located on your computer and places them in the dedicated node right on the Welcome screen.

Can we use Eclipse formatter in IntelliJ?

All you need is to export settings from Eclipse (go to Eclipse's Preferences → Java → Code Style → Formatter and export the settings to an XML file via the Export All button.), and then open IntelliJ IDEA Settings → Code Style → Java, click Manage, and import that XML file by simply clicking Import.

How do I get Eclipse shortcuts in IntelliJ?

Shortcut to use Eclipse shortcuts in IntelliJ Idea: Press ctrl+`(also have tilde~ on it, button at the left side of digit 1). Then press 3 (Keymap) and select 2 (Eclipse). Done!


1 Answers

In Eclipse the Java Compiler Preferences can exported via File > Export...: General > Preferences. Such an exported file only contains the settings that differ from the default setting.

For all Java Compiler Preferences, in a Java project in Project > Properties: Java Compiler make sure the checkbox Enable project specific settings is checked and use the project file .settings/org.eclipse.jdt.core.prefs.

I don't know if this files can be imported into IntelliJ. In my experience, there are only correspondences Inspections for simple checks. While comparing, I noticed that the (potential) null pointer access check of Eclipse finds problems that IntelliJ does not find. Surely there are also cases where Eclipse overlooks something or issues false warnings. Alternatively, you could use the Eclipse compiler that comes with IntelliJ. I haven't tried it yet, but with the -properties <file> pointing to the .settings/org.eclipse.jdt.core.prefs file, it should be possible to see the problems found by Eclipse in IntelliJ. But remember that in IntelliJ the files are not compiled on saving but before execution.

like image 199
howlger Avatar answered Oct 06 '22 11:10

howlger