Developing Liferay Portlets with Maven

This tutorial explains how to create Liferay portlet plugins using Maven and the anatomy of the Liferay Maven portlet plugin project.

Creating a Portlet Plugin

To create your Liferay portlet plugin project, just follow the Creating Liferay Maven Plugins from Liferay IDE tutorial or the Creating Liferay Maven Plugins from the Command Line tutorial, making sure to select Portlet as the plugin type.

Since it’s helpful to familiarize yourself with the Liferay portlet plugin project’s anatomy, that topic is covered next.


A portlet project created from the com.liferay.maven.archetypes:liferay-portlet-archetype has the following directory structure:

  • portlet-plugin/
    • src/
      • main/
        • java/
        • resources/
        • webapp/
          • css/
            • main.css
          • js/
            • main.js
          • WEB-INF/
            • liferay-display.xml
            • liferay-portlet.xml
            • portlet.xml
            • web.xml
          • icon.png
          • view.jsp
    • pom.xml

Maven creates the src/main/java/ directory automatically. It holds the portlet’s Java source code (e.g.,, and portlet-plugin/src/main/webapp holds its web source code. If you’ve created any portlet plugins using the Plugins SDK, you might have noted it uses a different directory structure.

The following table illustrates the differences in the locations of the Java source code and web source code for a Maven project and a Plugins SDK project:

Location | Maven project | Plugins SDK project | ———– | —————– | ——————— | Java source | src/main/java | docroot/WEB-INF/src | Web source | src/main/webapp | docroot |

You now know how to create Liferay portlet plugins in Maven.

Deploying Liferay Plugins with Maven

MVC Portlets

Liferay Faces

« Creating Liferay Maven Plugins from the Command LineDeveloping Liferay Theme Plugins with Maven »