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 the previous blog. You can start exploring the Liferay 7 Administration section after successful installation. However, just a plain Liferay 7 server is not sufficient to cater to business requirements. 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 existing modules based on your need. It is built on top of the 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 the OSGi platform. It is used to build a loosely coupled modular application. The single unit of development with all previous Liferay releases was called a Plugin like a portlet plugin, hook plugin, theme plugin, layout plugin, and EXT plugin. But starting with Liferay 7, the thing has been changed from plugin to module (or bundle).

Though Liferay 7 has backward compatibility and still supports plugin development through Plugin SDK, Liferay recommends using modules wherever possible. Because of this, you should be aware of the difference between Liferay modules vs. the Liferay plugin. In Liferay 7, theme and layout templates are still developed and deployed in a traditional way (WAR packaging) as a plugin, but you can develop portlets and hooks as a module.

While starting the Liferay server, you may observe that most OOTB portlets are developed as a set of modules/bundles. To develop a new portlet or customize any existing features (through hook), you need to apply OSGI standards and specifications.

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

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

Install Liferay IDE

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

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

Liferay IDE

It is an 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 the 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. The 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 the existing plain eclipse.

If you already have a 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 the Eclipse market place

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

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

Through Install New Software

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

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

Through update site Zip file

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

  • Download the Liferay IDE plugin (ZIP) file from the Other Downloads section of the 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 the Help menu and click on Install New Software.
  • Click on the Add button.
  • Give an appropriate name like Liferay IDE.
  • Click on the Archive button and point to the ZIP file that you have downloaded. Click on the Add button.
  • Select the (topmost) checkbox and click on the Next button. Follow the instructions in the next set of screens.

Liferay Developer Studio

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

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

Tools used by Liferay IDE

Liferay IDE internally uses certain tools for various activities like creating projects, building them, deploying them, 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 a set of commands used to deploy the module into the Liferay 7 instance. You can also use Maven to build a module.

In terms of flexibility, developers are free to use Blade CLI explicitly to create project structure and do the rest of the work in IDE or directly create the project structure from Liferay IDE wizards. These wizards internally use 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.