Liferay Plugin project can be created in Liferay IDE. We can add multiple portlets in single liferay plugin project. They all combined in single WAR file.
When we build such plugin project, all plugins will be part of single WAR file. But when it deployed , then each plugins (porltet,hooks,theme and layouts) will be deployed as separate folder under <<Liferay Bundle>>/tomcat/webapps folder.
Let us see how to create multiple plugins ( Portlets, Hooks, Layouts, Theme) in single Liferay plugin project in eclipse.
Give project name as multiple-plugin and -portlet will be appended by eclipse IDE so that the final project name will be multiple-plugin-portlet as per below screenshot.
Important Note :- Don’t confuse with the Plugin project and portlet. Let me differentiate them.
- When we want to create any Liferay component ( like portlet, hook, theme etc) we need to first create Liferay Plugin project.
- When we create Liferay plugin project from eclipse,( by clicking on File–>New–>Liferay Project ) it will give option (like portlet, hook, layout, theme or ext) as below screenshot.
- If we choose Portlet then it will create Liferay plugin project with by portlet (which have same name as project we gave in this wizard).
- If we choose different plugin type then it will create Liferay plugin project by that selected component.
- In short, When we create Liferay plugin project, it will create the component of selected plugin type with same name as plugin project.
- So you can consider Liferay plugin project as container where all liferay components resides as per below screenshot.
- Outer side section (blue border) with cloud shape is the Liferay Plugin project.
- Each rectangle withing it is showing various components (Liferay Plugins)
- The Yellow rectangle (with named Default Component) shows the default component. This component type will be same as we have selected while creating plugin project.
- In short, the default component will be portlet, if plugin type portlet is selected while creating plugin project. It will be hook it plugin type Hook is selected while creating plugin project etc.
- Liferay Plugin project (for plugin type portlet ) will only accommodate plugins of type Portlets, Hooks or Layouts. Theme and ext can’t be mix with portlets and Hooks in same plugin project.
- if you want to create Theme or ext plugin, you need to create separate plugin project.
Add multiple portlets
- This time, it will first ask in which plugin project do we want to add new portlet ?
- Its showing drop down and we choose it multiple-plugin-portlet
- Give the appropriate value for Portlet class, Java Package ans super Class.
- I gave the value as shown in above screenshot.
- Now click on Finish button