Wednesday, September 21, 2016

[Liferay] Multiple Service Builders in one Liferay Project

While working on liferay projects and portlets, sometimes we have a huge amount of service entities and we can logically group them and divide into multiple files and then import into main service.xml file.

Lets take an example of a company intranet where several modules are to be designed to support employee information, leaves, timesheet, projects, performance evaluations, trainings, meeting room booking etc. Our main service.xml will look like

This service.xml file can include any number of entities just like we add in usual way. For specific modules, we have imported children xxx-service.xml files.

The name of the files need not to be in xxx-service.xml, it can be anything that suits you.

The child xml files will contain entities related to a specific module. For example leave management system related service lms-service.xml will be like -

Our performance management system related service pms-service.xml will be like -

Hope this helps you to manage your long entities into smaller xml files and set you up with a short, readable, and organized service.xml. :)