Liferay is open source portal. Its source is freely available.Sometimes we need to refer of liferay source during development. Its convenient if we can configure Liferay source in eclipse.
In this article, we will see how to import / configure Liferay source in Eclipse (or Liferay Developer Studio). This is very useful when,
- You need to refer Liferay class
- You are writing Liferay hook plugin and you want to override existing JSP.
- You want to debug existing Liferay classes in debug mode to understand the flow.
- You wan to see out of the box properties defined in portal.properties file
So let us see how to do it.
First you have to download Liferay source of latest version from Liferay Web site. Once this is done, you can unzip it at some place in your local machine. (e.g. c:/dev).
Configure Liferay Source
Follow below steps to configure Liferay source into eclipse
STEP 1. Right click at package / project explorer and choose Import.
STEP 1. Right click at package / project explorer and choose Import.
STEP 2. Click on Existing Projects into Workspace.
STEP 3. Point the directory where you unzip liferay source from Browse button.
STEP 4. Once its imported, it will be available in project / package explorer in eclipse.
Brief about Liferay source
- definitions folder
- contains all dtd
- portal-impl
- contains all liferay implementation java classes. They resides in portal-impl.jar under tomcat/webapps/Root/WEB-INF/lib folder at runtime.
- These classes are not accessible to portlets directly.
- portal-impl/test
- all unit test cases for implementation classes
- portal-service
- Contains all liferay service java classes. They resides in portal-service.jar under tomca/lib/ext folder
- These classes are accessible to any plugin (Portlet, hook, theme etc)
- portal-service/test
- all unit test cases for service classes
- util-bridge,util-java,util-java,util-taglib
- Contains all liferay utility classes
- portal-web/html
- Contains all portal / portlet jsp
- portal-web/layouttpl
- Contains all layout template used in liferay out of the box
- portal-web/WEB-INF
- Contains portlet and liferay specific configuration files like portlet.xml, liferay-portlet.xml, struct-config.xml etc.
- sql
- Contains DB scripts for out of the box liferay functionality.
and its done. It’s good practice to configure Liferay source when you do development so that whenever you need to refer any out of the box code, it is readly available.
Feel free to ask questions / Suggestions
I would recommend looking at index page ‘A Complete Liferay Guide‘ to browse all topics about liferay.