Irina has posted 29 posts at DZone. View Full User Profile

IntelliJ IDEA Keeps Eclipse Projects in Sync

  • submit to reddit

IntelliJ IDEA provided Eclipse integration for quite a long time, but with the version 7.0 this integration became really seamless, enabling you to pull an Eclipse project into IntelliJ IDEA in just one click, or flexibly configure import options. Which is even more important for the teams that use both development environments, this integration makes it possible to automatically keep Eclipse and IntelliJ IDEA projects synchronized. Let’s talk about these new features in more detail.

Now an easiest way to import an Eclipse project to IntelliJ IDEA does not require performing any special import procedures - it is enough to just open an Eclipse project file.

This is how it's done. Same as for Maven, on the main menu, choose File | Open Project, and find the desired Eclipse project file.













IntelliJ IDEA creates a new project on the base of the specified Eclipse project with the default settings, and the new project, module and workspace files are added to the directory with the Eclipse sources. As you can see, the new project preserves the structure of the Eclipse project and its libraries:











However, if you deal with a whole Eclipse workspace, you might want to gain more control over the projects. In this case, use the import facility provided by the New Project wizard (File | New Project). With the option Import project from external model, select Eclipse and specify the target location of the resulting modules.
















On this step, you can link the source Eclipse projects and the resulting IntelliJ IDEA modules together, which means that they will be automatically kept in sync. If a workspace contains several projects, select the ones you want to be imported to IntelliJ IDEA, specify the resulting project name – and have it ready. Each Eclipse project in a workspace is imported into an IntelliJ IDEA module:










Now let’s have a look how the synchronization works. Suppose you open for edit a class in IntelliJ IDEA, and type some code, for example, the abbreviation of the main method:


On pressing space, the main method is generated:









When the original project is opened in Eclipse, external changes are recognized, and the IDE prompts you to accept or reject these changes:







If you choose to load changes, Eclipse will show the updated source code:










Consider the reverse situation: you edit a class in the linked Eclipse project. When you switch to IntelliJ IDEA, the changes introduced in Eclipse are brought in, and your project is silently synchronized.


Published at DZone with permission of its author, Irina Megorskaya.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)