• Liferay 7 Portlet Creation using Liferay IDE

    Posted on August 31, 2016 by Hamidul Islam in liferay 7.


    aimPrior to  Liferay 7  we used either Plugin SDK or maven for portlet creation. Liferay 7 has introduced the concept of OSGI where we can avoid Plugin SDK.In OSGI everything is treated as module. In this article I will explain how to create a sample portlet using Liferay IDE. The sample portlet would be nothing but OSGI module.

    Before you follow this article ensure ensure that below 2 items are installed properly in your machine.

    1. liferay-portal-tomcat-7.0-ce-ga1-20160331161017956.zip

    2. Liferay IDE

    Create the Project in Eclipse:

    So to start with lets create new Liferay Module Project in eclipse. Navigate in the eclipse

    New→Other→Liferay→Liferay Module Project

    Liferay Module Project

    Generated Portlet Class:

    As based on input given to the IDE the generated portlet class is

    package com.proliferay.portlet;
    import com.liferay.portal.kernel.portlet.bridges.mvc.MVCPortlet;
    import javax.portlet.Portlet;
    import org.osgi.service.component.annotations.Component;
    	immediate = true,
    	property = {
    		"javax.portlet.display-name=sample-portlet Portlet",
    	service = Portlet.class
    public class SamplePortlet extends MVCPortlet {




    Note 1:

    Prior to Liferay 7 we used  portlet.xml as portlet descriptor. In Liferay 7 we can create portlet even without using portlet.xml. However the equivalent xPath of portlet.xml can be used as OSGI portlet service property as shown in the above code. For all the mappings you can look here


    Note 2:

    In general we deploy liferay portlet as WAR file. However in OSGI based application everything is considered as bundle which is nothing but JAR file. To build the OSGI bundle or JAR, use Gradle Tasks view in the eclipse.


    After building the project we will get the bundle under libs folder


    Note 3:

    We can deploy the bundle in the hot deploy folder of Liferay. Once the portlet is deployed we can add the portlet in Liferay page as usual. 


    The sample example is to quick start portlet development in Liferay 7. In the portlet class no code has been written.All the files are generated by Liferay IDE. You can download the portlet and deploy in your machine to explore it further. 


    Download Sample Portlet

One Response so far.

  1. Aravind L says:

    This article really helpful for my project using liferay 7 . I got the clear Idea of liferay 7.

%d bloggers like this:

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.