Setup Liferay 7 development environment

Liferay 7 development environment setup is the next you should know after installing and configuring Liferay 7 in your local

We have seen how to install and setup the liferay 7 (DXP) server in previous blog. You can start exploring Liferay 7 Administration section after successful installation. However, just plain Liferay 7 server is not suffice to cater business requirement. For example, the out of the box look and feel may not match with what your client needs. You need to develop some sort of custom user interface.

Liferay 7 (DXP) is a highly customizable platform. You can develop custom modules or modify exsting modules based on your need. It is built on top of OSGI modular framework. If you want to work as a Liferay Developer, It is essential to know how to code with Liferay 7 (DXP).

Architectural changes in Liferay 7 development environment

The major architectural difference between Liferay 7 and all previous releases is the introduction of OSGI platform. It is used to build loosely coupled modular application. The single unit of development with all previous releases of Liferay was called a Plugin like portlet plugin, hook plugin, theme plugin, layout plugin, EXT plugin. But starting with Liferay 7,thing has been changed from plugin to module (or bundle).

Though Liferay 7 has backward compatibility and still support plugin development through Plugin SDK, Liferay  is recommending to use module wherever possible. Because of this, you should aware about the difference of Liferay modules vs Liferay plugin. In Liferay 7, theme and layout templates are still developed and deployed in traditional way (WAR packagin) as plugin but you can develop portlets and hooks as a module.

While starting the Liferay server, you may observed that, majority of OOTB portlet are developed as set of modules / bundles. So for development of new portlet or customization of any existing features (through hook), you need to apply OSGI standards and specification.

In other words, you need to develop OSGI compatible module for development in Liferay 7. It is OSGI container where all modules are deployed and executed. Unlike plugins, modules are packaged in JAR file which contains set of java classes, OSGI specific configuration and optional resources (like JSP and properties file).

The first and foremost thing is to make development environment ready. In this article I will walk through you on how to setup Liferay 7 development environment, so let us start.

Install Liferay IDE

Before installing Liferay IDE, you must have to install latest version of Java (8 or above) in your local. Please refer the article on How to install Java on window machine and install Java 8.

Liferay provides an eclipse based IDE to start development work.You need to download the IDE. It comes in following two flavors.

Liferay IDE

It is eclipse plugin and provides a way to create various modules. There are further three ways to get Liferay IDE to setup Liferay 7 environment setup

Install Liferay IDE bundle from scratch.

It is nothing but latest eclipse JavaEE package with Liferay IDE pre-installed. Below are the steps to install and configure it.

  • Open the Liferay IDE Page
  • Goto Other Downloads Section
  • Download Liferay IDE installer for your OS. Name would be kind of Liferay IDE xxx Installer (OS version). At the time of writing this, the latest version of Liferay IDE is 3.3.0 GA1.
  • Once downloaded, click on EXE and follow the instructions to install it on your local machine.

Install Liferay IDE into existing plain eclipse.

If you already have plain eclipse J2ee package with version 4.7 or higher version, you can simply install the Liferay plugin on top of your existing eclipse for Liferay 7 development environment setup. There are 3 ways to configure it.

Through Eclipse market place

Below are the steps to install Liferay IDE (eclipse plugin) through eclipse market place.

  • In your eclipse, go to Help menu and click on Eclipse Marketplace.
  • search for Liferay IDE. Mostly you will see first result for that. Click on Install button and follow rest of the instruction.
  • Alternatively, you can open the Eclipse Marketplace window (don’t search anything) and drag and drop the link called Install, mentioned in Using Eclipse Marketplace section on Liferay IDE page.

Through Install New Software

You can install Liferay IDE plugin with new software installation option in eclipse. Below are the steps.

  • In your eclipse, go to Help menu and click on Install New Software.
  • Click on Add button.
  • Give appropriate name like Liferay IDE.
  • Copy the link from Using an Update site section of Liferay IDE page and paste it in Location.
  • Click Add button.
  • Select the (top most) checkbox and click on Next button. Follow the instructions in next set of screen.

Through update site Zip file

Another option is to install the Liferay IDE is with update site zip. This is more or less similar to previous option. Below are the steps.

  • Download the Liferay IDE plugin (ZIP) file from Other Downloads section of Liferay IDE page. The link name would be something like Liferay IDE XXX Archived Update-site, where xxx is the current stable version.
  • In your eclipse, go to Help menu and click on Install New Software.
  • Click on Add button.
  • Give appropriate name like Liferay IDE.
  • Click on Archive button and point the ZIP file that you have downloaded. Click on Add button.
  • Select the (top most) checkbox and click on Next button. Follow the instructions in next set of screen.

Liferay Developer Studio

Liferay Developer Studio is a properity product build on top of Liferay IDE and provides a single, integrated development environment for creating apps and modules for Liferay DXP platform. This is license product from Liferay.

I have installed Liferay IDE installer. For most of the cases, Liferay IDE is just suffice for Liferay 7 development environment setup.

Tools used by Liferay IDE

Liferay IDE internally uses certain tools for various activities like creating projects, building it, deploying it etc.

Creation: For creating the project structure (with all folder and file structure along with required configuration and resource files) for various modules, Liferay IDE uses Blade CLI (Command Line Interface) tool. It is a command line java tool used to bootstrap Liferay 7 module development.

Build & Deploy: Blade CLI uses gradle (internally) to build Liferay 7.0 modules by default. Blade CLI has set of commands that is used to deploy the module into Liferay 7 instance. You can also use Maven to build module.

In terms of flexibility, developer are free to use Blade CLI explicitely to create project structure and do rest of the work in IDE or directly create the project structure from Liferay IDE wizards. These wizards internally uses Blade CLI to create the project structure.

Awesome…. !!! Your Liferay 7 development environment is ready. You can now start developing various modules and apps on Liferay 7 platform.

Recommended For You

About the Author: Nilang

Nilang Patel is a technology evangelist who loves to spread knowledge and helping people in all possible ways. He is an author of two technical books - Java 9 Dependency and Spring 5.0 Projects.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.