IntelliJ

Aus SDQ-Wiki

This guide was kindly provided by Thomas Mayer

How to use IntelliJ with Eclipse Plugins

Here you find information how to develop Eclipse plugins with IntelliJ and what the constraints are:

Constraints

  • IntelliJ has no integrated support for Eclipse-Plugin projects. We use a plugin instead.
  • It is not possible to create Eclipse-Plugin projects with IntelliJ (unless you create all files by hand). Therfore you need to use Eclipse to create the project initially.
  • IntelliJ has no integrated support for Xtend. There are plugins, but they are outdated and not compatible with the newer versions of IntelliJ. You need to run Eclipse to generate the Java sources of the *.xtend files.
  • Maven Tycho does not work properly with IntelliJ, so building the plugin is only possible via Eclipse or directly via the command line. Let IntelliJ know to ignore the maven files, because it tries to build the maven project.
  • You need an Eclipse instance in order for this to work. IntelliJ uses this instance to resolve plugin dependencies.

Step by Step Instructions

Fllow these instructions to use IntelliJ with Eclipse plugins:

1. Install "Eclipse PDE Partial"

In the menu bar click Files -> Settings... to open the settings. In the sidebar, navigate to the Plugins section and switch to the Marketplace tab. Search for "Eclipse PDE Partial" and install the plugin.

2. Open the Project

In the menu bar click Files -> Open.... Select the root folder of the project and open it. If the plugin files are directly located in the root folder (you only have 1 Eclipse-Plugin project) IntelliJ should detect and offers you the possibility to configure it. Don't use this assistant as it sometimes does not configure the modules correctly. Otherwise, if you have several Eclipse plugins in the root folder e.g. as modules, continue normally.

3. Ignore Maven Project

If you don't use Maven, you can skip this step. Maven Tycho does not work properly with IntelliJ, so we ignore the project to avoid seeing maven erros. Therfore right click the pom.xml file. In the context menu hover over Maven... and select Ignore Projects. Confirm the prompt.

4. Add Eclipse plugins as modules

In the menu bar click Files -> Project Structure.... At the sidebar under Project Settings, click Modules and delete every existing module by selecting every single one and pressing the - (minus) button at the top of the list. Now we add the plugins as modules. Press the + (plus) Button and select Import Module. Select the root folder of the plugin project (e.g. plugins located in a bundles folder). A configuration assistant opens, select the following:

  • Create modules from existing sources, click Next
  • Deselect sources located in a target folder, click Next
  • dont change anything, click Next
  • dont change anything, click Next
  • make sure the MANIFEST file is ticked, click Create

The assistant closes. Repeat this for every remaining plugin in this project. Now press Apply and close the project structure window. In the project explorer, you should now see every added plugin as a module.

5. Add Eclipse Dependencies

Finally, we need to let IntelliJ know where to find the plugin dependencies. Be aware, that IntelliJ does not load the dependencies from any provided maven configuration. Instead, we must define an Eclipse instance, which has the required dependencies installed. In the menu bar click Files -> Settings... to open the settings. In the sidebar, navigate to the Languages and Frameworks section and unfold it. Click at the Eclipse Target entry. Add a new Eclipse Target by pressing the + (plus) button. Choose an alias name and provide the path to your Eclipse instance (Select the folder which contains the eclipse.exe file). Click Apply and close the settings. IntelliJ should now be abale to resolve dependencies from eclipse plugins.