When I first started at Liferay I started using Eclipse. After about six months I found the Web Toolkit for Eclipse. I used that for about a year and a half total, until I got staffed consulting for the current company I'm consulting for. Once I got here I saw that all the in house developers were using IntelliJ Idea. As we are an open source software company, we qualify for free IntelliJ licenses so I decided to give it a shot. I've now been using IntelliJ for about ten months, and I must say that I love this thing.
What is the difference?
- Can be a little faster on the debug side, although to be fair I switched to a Macbook Pro nearly the same time I switched to IntelliJ, so it could be that.
- Lots of plugins
- Hot deploying classes and jsps into Liferay (no tomcat bounce required)
- Can be faster when reindexing deployed files
- Open Source
- Ctrl+Shift+O for optimizing imports easily. I have yet to find the equivilant in IntelliJ. it will remove unused imports for you, but not import ones you need.
- No licensing concerns
- Did I mention free?
- Amazing configurations for ignore lists, no indexing and searching compiled classes unless you want to.
- In windows the debugger can use shared memory, in OS X I can only get socket working which can be slower
- Expression evaluations on the fly
- Intellisense is really great once you get used to it
- Auto import of classes in JSPs
- Steller JSP support overall, ability to jump into a java class from a jsp just like you can from a java file
- Facets are really cool, you can very easily change relative paths
- Find useages of a method by clicking it and holding Shift+F7
- XML Auto completion from a DTD
- Code coloring of Velocity
- Local history
- While Ctrl+Shift+O doesn't do what I want, 99% of the time when you copy/paste code it automatically adds the imports for you so you shouldn't have to Ctrl+shift+o
I want to talk a few of these for a minute, as Facets, JSP integration, and local history were the deciding factors in me staying with IntelliJ over eclipse. Overall they are both good IDEs, I even built a few plugins for Eclipse, but IntelliJ just does a few things so much better that it tips the scales.
Local history can actually be trusted in IntelliJ. I had so many problems with Eclipse where I would change something, close eclipse for some reason, and need to see what I changed again. Short of going to SVN I could never get this to reliably work in Eclipse... with IntelliJ it just works, every single time.
Liferay has a somewhat strange layout for it's web-inf and html folders. In Eclipse I never really code path completion to work well in JSPs because it always looked at the wrong spot for files. In IntelliJ I just setup different facets that will help the IDE help me. Here is an example. I have a facet called WEB-INF. In Liferay, when you reference a file in WEB-INF (tagfiles are a GREAT example here) you do it like this:
<%@ taglib prefix="showMore" tagdir="/WEB-INF/tags/wj/showmore" %>
The problem there is that by default, the IDE wants to autocomplete like this:
<%@ taglib prefix="showMore" tagdir="/docroot/WEB-INF/tags/wj/showmore" %>
I simply made a web facet and said that when I type /WEB-INF I really want you to look at /docroot/WEB-INF. This small change saves me so much headache throughout the day. I also did the same thing with /html instead of /docroot/html.
You know how in eclipse when you go to an init.jsp file in the ext environment it always freaks about the init.jsp includes from portal because it can't find it? I once again used a web facet (called portal-web) and I linked / to /liferay/builds/4.3.x/portal-web/docroot. Now when I say:
<%@ include file="/
right there it starts autocompleting. It lists out everything in both portal-web and ext-web for me, because I have access to both inside Liferay! Doing this then:
<%@ include file="/html/common/init.jsp" %>
it's a problem, I can even click init.jsp and press ctrl (cmd) + b and it will jump me right into the init file in portal.
I tend to run IntelliJ with one "Module" and two "Content Roots". One content root is portal, the other is ext. The plus here is that the debugger knows about the portal source files, and I can easily jump between jsp files as well.
As for the Intellisense a great example of why it's so cool is the following:
I can go to a view.jsp and type "WCLSU" and ctrl+alt+space and it will gve me a dropdown that asks which class I want. In my case I create WhatCountsLocaServiceUtil and WhatCountsLocalServiceUtilTest (You do make jUnit tests for your code, right?). I hit enter and then ctrl+space, which gives me a list of it's methods to choose from. Once I choose one, it adds the import statement for me at a specified position in the page (you can set this in project settings). See screenshots below for what it looks like.