
Introduction to Liferay (for New Developers)
This article needs updating. For more information, see Wiki - Need Updating.
If you do not plan on doing development using Liferay (creating custom portlets, customizing the existing Liferay system, etc.), and instead plan to use the existing features of Liferay unmodified, you may instead be more interested in Introduction to Liferay (for New Users).
Key Technologies #
These technologies are used in Liferay (the more you know about these, the easier Liferay is):
- JSR 286 Portlet Specification 2.0 http://jcp.org/aboutJava/communityprocess/final/jsr286/index.html
- J2EE (Servlets and .JSPs, optionally EJBs if transactions needed)
- Tomcat or JBoss (or numerous other application servers) http://tomcat.apache.org/
- Any SQL database (mySQL or numerous other SQL databases)
- Struts + Tiles http://struts.apache.org/ (while Liferay supports a variety of presentation technologies, the pre-packaged portlets are developed using JSP and Struts)
- Velocity http://velocity.apache.org/
- EasyConf http://easyconf.sourceforge.net/
- Hibernate http://www.hibernate.org/
- Spring http://www.springframework.org/
Setting up a development environment #
There are two major parts to the Liferay system: the "Portal Container" itself (referred to as the kernel), and the individual portlets (sometimes referred to as "plug-ins"). When developing for Liferay, you can set up your environment in a variety of ways (see also "platform specific tips" below):
Liferay v. >= 6
Last updated: 18-06-2010
There are several plugin types that you can use:
- Themes - new look for the portal
- Portlets - your own applications
- Layouts - templates for defining portlets' placement on the page
- Hooks - lightweight changes of the portal
- Web Plugin - simple way how to integrate existing web application using IFrame Portlet
- Ext Plugin - extending the portal core
Thus development can be divided into 2 ways:
- Creating new functionality - you can use Themes, Layout Template, Portlets and Webs, see Plugins SDK wiki page
- Extending portal - using Portal Hook Plugins and Ext Plugin
There is Liferay Plugins SDK which covers all types of plugins you can deploy into the portal. The Plugins SDK use Ant for building the plugins into WAR files, which can be easily deployed.
For development using Maven please see Liferay Maven SDK - innovation for the Liferay v. 6.
You can also create all types of plugins using your favorite IDE. All these plugins are just standard web applications with its proprietary configuration files.
Liferay v. > 4.3.3 <= 5.2.3
Needs to be covered too!
Liferay v. <= 4.3.3
Last updated: 11-04-2007 Covers version: 4.3.3
- Develop "hot deployable" portlets that are stand-alone .WAR files and can be deployed on any free-standing Liferay distribution. For more information, see:
- Develop in a "extension environment" of the Liferay kernel. The "extension environment" is a development environment that separates your customizations from the core Liferay source tree. The idea of the extension environment is to isolate your changes from the core code. When updates come out to the core, you simply "rebuild" the extension environment, which mixes your custom code with the updated code from the Liferay community. For more information, see:
- Development in the ext environment (official documentation)
- Development in the ext environment
- What is the ext environment
- Setting up the Extension Environment
- Develop directly in the Liferay source tree. This method is for those who want to contribute their changes back to the Liferay community and thus are developing for the Liferay kernel directly. see:
Platform specific tips #
- Windows
- OSX
- Linux
IDE specific tips #
Customizing and Extending Liferay #
- The "look and feel" of the portlets and the portal in general is the responsibility of the Liferay Theme system. See Themes and Layout Template
- The words and phrases displayed throughout the Liferay system can be customized using Liferay's support for language customizations. See Language/display customization or Languagedisplay customization
- JSPs, some entries from portal.properties and language bundles can be changed through Hooks. Hooks also enables definition of event handlers and model listeners. Additionally, there is support for over-defining Spring beans (from Liferay v. 6). See Portal Hook Plugins
- Extension Environment (EXT) was used to change the portal core. For Liferay 6 is EXT deprecated and you can use Ext Plugin.
Developing portlets #
Liferay supports a wide variety of presentation technologies. You can develop your portlets using JSP+Struts, JSF (both JSP and Facelets), as well as many others. Sample portlets and source code can be found at the Official Plugs download page. The latest sources for these samples, as well as newer presentation technology samples can found in the SVN repository in the plugins/trunk/portlets sub-directory of the lportal project. For more information on the repository, see SourceForge, and Liferay's SVN FishEye.
- "Hot deployable" portlets are stand-alone .WAR files and can be deployed on any free-standing Liferay distribution.
- Portlets are generally created with a corresponding "service layer" - a set of code that is presentation independent, and performs the primary business logic, manipulation of the data entities, etc. This service layer is built using a tool called "ServiceBuilder". For more information, see
- Liferay supports a "fine grained" permission system that goes beyond the basic J2EE role based authorization specification. For information about permissions, see Permissioning Explained
- Tools useful for Cross-Browser development.
Sources of documentation #
- The XML DTDs for many of the portal files (like liferay-portlet.xml, liferay-display.xml, liferay-look-and-feel.xml, etc.) contain a wealth of human readable documentation. You can find the DTDs in the source tree under /portal/definitions. They also appear in the binary distribution on a deployed server in the webapps/ROOT/dtd directory (that is the location for Tomcat).
- The file "portal.properties" contains many settings that you can customize in your portal deployment. See the file /portal/portal-impl/classes/portal.properties
- The file "system.properties" contains many settings that you can customize in your portal deployment. See the file /portal/portal-impl/classes/system.properties
- Portal javadoc & PDFs
- Source code for nerds (user: guest, password: empty)
Developer tips and tricks #
- Liferay uses log4j to do its logging. Information on log configuration can be found here How to configure the logs in Liferay
- If you are an Eclipse user, there are several tricks you can use to aid in your development efforts. For more information, see Eclipse IDE#Tips and Tricks
Other developer resources #
- A UML diagram of the core Liferay data structures are available here: Entity model
- Many developers in the Liferay community have created their own "notebooks." This can be a good source for a lot of specific information you may not find in the general documentation. For more information see Developer Notebooks
- Introductory article to the Java portlet specification
- Wikipedia article describing "Web Services for Remote Portlets" - an interesting part of the JSR168 specification
- Free on-line book about portlet development
- Liferay for Dummies
- Official Liferay documentation
- Liferay 4 Installation Guide Contributions. This contains useful fixes and corrections to the official documentation, which are written by the Liferay community, but not yet applied to the official documentation.
- Development Environment. This is to collaborate with the Liferay project.
- Setting up the Extension Environment. This is to develop your own customizations and allowing for easy future Liferay upgrades.
- Eclipse IDE or Netbeans IDE
- Content Delivery Network. How to setup your installation of Liferay with a CDN.
- How to configure https feature to secure sensitive content using SSL/TLS transport.