Setup Debugging with Devstudio

This Blog will quickly explain how to setup debugging in a Liferay Devstudio(EE), which will be leading us through easy steps:

 

  • get devstudio from liferay customer portal (http://www.liferay.com/group/customer/downloads/dev-studio/1.4)
  • get the source code from liferay customer portal (http://www.liferay.com/group/customer/downloads/liferay-portal/6.0)
  • installation of devstudio
  • installation of liferay source code as a project in eclipse
  • start debugging

 

So let us start:

First we download the archives from the liferay customer portal:

  • Go to Liferay.com and login
  • select Customer Portal, Select your Liferay Portal Version and get the Devstudio or just use the latest form here http://www.liferay.com/group/customer/downloads/dev-studio/1.4
  • Make sure you download the correct version for your OS

DevstudioDownload

 

Next we want to download the source code:

  • Back on the Product Selection page we navigate to the liferay version we want to debug (6.0 SP2 with Devstudio 1.4, 6.0SP 1 with Devstudio 1.2)
  • From the Box we choose the Liferay Source Code

Liferay Source Download

 

Once we have the Devstudio we can run through the Wizard based Installation process, requiring us to deploy a valid license. 

For the easy setup we can choose our workspace to be in the folder where we installed the Devstudio into, which is on my end: /Volumes/data/Liferay Developer Studio 1.4.0

Note that I am using a Mac, so my Workspace will be

/Volumes/data/Liferay Developer Studio 1.4.0

The source code of the portal ends up here

/Volumes/data/Liferay Developer Studio 1.4.0/portal-trunk

can also be 

c:/workspaces//Liferay Developer Studio 1.4.0/portal-trunk

if you are using another OS

 

If you want to debug liferay services it is also advised to install a proper database, as explained here:

http://www.liferay.com/community/wiki/-/wiki/Main/Database+Configuration

Elsewhise you can proceed and liferay will use HSQL as a database.

Next Step is to setup the liferay source code as a project in Devstudio:

  • Go to the Menu: File/Import or right click in the Project Explorer/Import

Import the source code as a project

 

From General we choose Import Existing Project

 

Import existing project

Next we select the directory where we unzipped the source code into and click finish.

Select source folder

Ok we are ready to setup the debugger now, by clicking on the small bug in the Devstudio Toolbar and click on Debug Configurations.

 

Debug Configuration

Then in the next Dialoque we will configure the liferay project as a source folder for the liferay server 6.0 EE.

  • Double click on Liferay v6.0 EE (Tomcat 6)
  • Select the Source Tab from the right
  • Click the add button
  • Choose Java Project
  • Select portal-trunk
  • Click ok
  • Leave the Dialoque and save

Setup Debugger

 

If we have setup everything correctly we should be able to debug now, lets open a Java File and set a break point to prove we actually can:

  • Press Ctrl(Cmd) + Shift + R and open StartupAction.java (Package: com.liferay.portal.events)
  • Set a breakpoint in line 65(Double Click on the left where the dot is on the screenshot)Set a break point
  • Start the Server in debug mode (Click on the small bug in the next menu)
  • Start debugging
  • You can open the Debug Perspective right now or wait until Devstudio catches the Debug event and shows a dialoque which will lead you there
  • Debugging
  • The play button on the top will let the server proceed execution and the arrow buttons to the left will let you proceed step by step

Enjoy debugging Liferay EE

 

Blogs
I agree with you, what i am saying is Liferay Developer Studio is only available to EE customers. Does licencing key for Liferay Developer Studio & Liferay Poral EE (whatever the pack we buy after Liferay 6) will vary?
Well, actually i see no reason, why this article was posted only for Developer studio, in fact this process can be done in any IDE and its interesting for anybody wondering how to debug Liferay portal.
Jan Gregor is right, you can apply this to any Eclipse Distribution or LIDE. But I have been asked by an EE customer how they debug on Devstudio, so instead of writing an email I choose to create a BlogEntry, which can be read from everyone.