On this page, you'll learn more about how to build and run the Saros IntelliJ IDEA plugin. Head back to the overview page, if you want to know more about the process of developing Saros-I and how to get involved in it.
Step-by-Step: Starting IntelliJ IDEA and Opening the Project
- If this is your first start of IntelliJ IDEA, you can safely select that you don't want to import anything.
- Assuming that you already retrieved the sources, you can now open the IntelliJ Saros plugin project:
- Navigate to your local Git clone and select the project
de.fu_berlin.inf.dpp.intellij. Then click "OK".
- IntelliJ IDEA will load the plugin module along with several auxiliary modules (the core module, the SWT plugin, and the two-part ui module) and display them in the project view on the left (or Alt+1).
- That's all. But in order to compile your source code, you need to set up and modify a Platform Plugin SDK (next section).
Step-by-Step: Create the proper Platform Plugin SDK
Why do you have to do this?
For building an IntelliJ IDEA plugin, you need certain libraries. Creating a new SDK only means: Create a new symbolic name, that points to an existing SDK. In this case, we're going to use the libraries that IntelliJ IDEA provides for building plugins: the "IntelliJ Platform Plugin SDK". The process is as follows:
- Go to "File" > "Project Structure"
- You'll see that IntelliJ IDEA could not find the Project SDK named "IDEA SDK". Therefore we will create one. Click on "New..." and select "IntelliJ Platform Plugin SDK".
- In case IntelliJ IDEA prompts "Cannot Create SDK", just click "OK" and select a JDK from your computer. Otherwise, just go to the next step.
- Select the home directory of the new SDK (there is nothing wrong with the default selection). Then select the JDK you want to use internally (again, the default selection should be fine).
- Now you have an SDK that provides the necessary libraries, but we still have to modify the name and some library settings. To modify your SDK click on "Edit".
- Since IDEA SDKs are referenced by their name (through the file
.idea/misc.xml) and the default name is generated using the build number of your local IntelliJ IDEA installation, using the default name would result in edit wars when other developers use different IDEA versions. Therefore, we use a common name for the IntelliJ Platform Plugin SDK regardles of the IntelliJ version.
Type "IDEA SDK" into the field "Name" and then apply your changes.
Saros provides the libraries it needs in the lib/ folder on its own. Some of them are also included in the IntelliJ SDK, but in a different version, that is incompatible with the one Saros provides. Since we do not want make all of Saros dependent on the IntelliJ libraries, we remove the duplicate libraries from the IntelliJ SDK, to use our own.
Select the tab "Classpath" and remove the following libraries (by selecting them clicking the big red "minus" on the right)
Optionally you may wish to add the IDEA sources to the SDK. This allows you to access the source code and code comments of IntelliJ classes, which can be very helpful. To enable this, get them via http://www.jetbrains.org/pages/viewpage.action?pageId=983225. This will get you the most current version of the sources.
As Saros/I is currently based on the IntelliJ IDEA Community Edition 13.1.7, you should switch to the matching release of the source. To do so, navigate to the base folder of the local git repository of the sources and excecute the command "git checkout tags/idea/135.1356". If you want to keep the current version of the sources as well, you can check out the needed release into another branch by excecuting "git checkout tags/idea/135.1356 -b BRANCH_NAME" instead.
Then add the IDEA source folder to the IDEA SDK, by pressing the big green "+" in the tab "Sourcepath"
Apply your changes and close the dialog.
Step-by-Step: Provide SWT binary and sources
Download the SWT sources that match your environment to compile Saros/I
For now, Saros depends on SWT, no matter whether you want to develop SWT UI or not. Download "SWT binary and sources" that matches your platform from here.
Unzip the file and copy "swt-debug.jar" and "src.zip" into
Rename "src.zip" to "swt-src.zip".
Now the project should compile.
Deploy the SWT-Plugin that comes with Saros to your IntelliJ plugin directory
In order to get Saros/I running you need to install the "swt library plugin". You can find it in the folder
To install the plugin please copy the whole folder
de.fu_berlin.inf.dpp.swt_plugin into your IntelliJ plugin directory. For more information about where this directory is, see https://www.jetbrains.com/idea/help/project-and-ide-settings.html.
Tip: Look in the following dialog to find the "plugins" directory which resides just next to Sandbox Home:
Now you are in the position to compile your own IntelliJ Saros plugin. To make this as easy as possible, we're going to create a Run Configuration in the next section.
Step-by-Step: Create a Run Configuration
- Find the little downward arrow in the top right corner, click on it, and select "Edit Configurations..."
- In the newly opened wizard, click on the plus sign (top left) and select "Plugin" (because we want our new Run Configuration to launch Saros, which is a plugin).
- IntelliJ IDEA will find the Saros intellij plugin and fill in the fields "Use classpath of module" and the "VM Options" for you. It will also add a "Make" before launching so your source code will automatically be built. The only thing left for you to do is choose a name for this Run Configuration, e.g. "Saros-I". Then you can apply your changes and close the wizard.
- Now you will find your new Run Configuration in the top right corner. You can launch it by clicking on the play button. IntelliJ IDEA will then compile your source code, create an IntelliJ IDEA plugin, and start a new instance of IntelliJ with this plugin installed, so you can play around with it and test its features.
From within IntelliJ IDEA:
- Inside the project, from the menu, choose "Build" > "Prepare Plugin Module 'de.fu_berlin.inf.dpp.intellij' for Deployment".
Using the command line:
Inside a terminal, open the IntelliJ project folder "de.fu_berlin.inf.dpp.intellij" and run
The resulting .zip file can be installed in another IntelliJ instance via "Settings" > "Plugins" > "Install plugin from disk..."
As far as we know, the IntelliJ Gerrit plugin does not work with out setup, since we use SSH keys. You can either work with Gerrit via
- Eclipse, like for Saros for Eclipse
- Using plain git (Gerrit is just a large and specially organized git repository, so all interaction can be done with standard git clients)
When refactoring Saros core code it is often useful to be able to refactor code in the IntelliJ and the Eclipse packages at the same time. The easiest way to so is to import the IntelliJ project in Eclipse and configure the appropriate libraries.
(If you find a way to build Saros for Eclipse in IntelliJ, please write us!)
The guide will assume, that you have Saros for Eclipse and for IntelliJ set up and running.
- In the "Git repositories" view, unfold "Working directory", right-click on "de.fu_berlin.inf.dpp.intellij" and select "Import projects...".
- From the bullet list, choose "Import existing Projects" and click "Finish" on the next page without changing anything.
- We need to add the IntelliJ libraries to the build path in order to compile the project. To do so open "Configure Build Path...", go to the "Libraries" tab, click on "Add Variable...".
- In the "New Variable Classpath Entry" dialog, select "Configure Variables..."
- In the opening Preferences pages, click on "New..." and create a new Classpath Variable called "INTELLIJ_LIB" (exact name) and add as Folder the "/lib" folder of your local IntelliJ installation (found in the IDEA folder).
Now your Eclipse is able to compile Saros for IntelliJ!
Ubuntu 14.04 LTS (64bit) and Linux Mint 17.1 (64bit)
When following the step-by-step setup instructions on this site, the following error message will be thrown when compiling the Saros-I project:
(java:30635): GLib-GObject-WARNING **: cannot register existing type 'GdkDisplayManager'
(java:30635): GLib-CRITICAL **: g_once_init_leave: assertion 'result != 0' failed
(java:30635): GLib-GObject-CRITICAL **: g_object_new: assertion 'G_TYPE_IS_OBJECT (object_type)' failed
To resolve the issue the following steps are necessary:
- Install libwebkitgtk-1.0.0, for example via using the APT packet manager:
sudo apt-get install libwebkitgtk-1.0.0
- Download SWT binary and sources version 4.3.2 (http://download.eclipse.org/eclipse/downloads/drops4/R-4.3.2-201402211700/#SWT)
- Unzip the file and rename "swt.jar" to "swt-4.4-gtk-linux-x86_64.jar". Replace the equally named file in