Tuesday, May 15, 2012

Configuration for Using Intellij IDEA to Develop Apache Wookie

Here I am sharing the steps I followed in configuring Intellij IDEA to develop Apache Wookie. As guidelines are only given in the site to start with Eclipse IDE, before starting coding I needed to configure Intellij IDEA to be aligned with the practices and conventions of Wookie, before starting coding for GSoC2012.

For the project we have to use SVN as version control system and Intellij by default facilitate it. We need to do the following set ups in addition.
  1. Dependency management
  2. Code style and template
  3. Debugging
Let’s look at how to deal with these.

Dependency management with Apache Ivy

Wookie use Ivy as the dependency manager. To easily compile the Wookie project inside Intellij, we need to have the plugging IvyIDEA installed. In order to do so, go to File>Settings>IDE Settings and select IvyIDEA from available pluggings as follows and install.

Ivy

Now once you open Wookie in Intellij, it will auto detect the ivy.xml file and resolve dependencies. In Tools>IvyIDEA menu you can resolve any dependencies if not auto detected. Further details are can be read on this plugin, at Intellij plugging repository

Code style and template

These steps are taken to conveniently maintain consistency and quality of the code.The etc/Intellij folder of Wookie distribution includes code_style.xml and code_template.xml which need to be placed inside Intellij configuration as follows. 
Place code_style.xml at <username>/<Intellij folder>/config/codestyles.
Note:To have the code style correct, it is better to use this plugging eclipse-code-formatter inside Intellij as it allows you to use original code style, which is distributed to be used in Eclipse.
Once this is done and code style is active for the project, Ctrl+Alt+L will reformat code accordingly.


Place code_template.xml at <username>/<Intellij folder>/config/templates.After restarting the IDE you can see the available templates by Ctrl+J key combination and easily use them.

Debugging

Start Wookie server in debug mode using the command ,
ant -Djvmargs="-Xdebug -Xrunjdwp:transport=dt_socket,address=8001,server=y,suspend=n" run
To connect Intellij to this server running on your local machine, go to Run>Edit configuration in IDE. On remote configuration do the following.
You can now set debug points and contribute to improve Wookie.