Share Services Between Plugin Portlets In Liferay

Leave a Comment
Sharing services between plugin portlets is very easy in Liferay. Usually people place services jar manually when they want to access any other portlet's services.

Here is the automated where liferay will take of the dependent service jar. You just need to name the dependent portlet's name.

Let say for your library management portlet you want to access services of student portlet. In liferay-plugin-package.properties file you need to enter below entry.

File liferay-plugin-package.properties you can locate inside WEB-INF folder.

required-deployment-contexts=\
    student-portlet

When you deploy library-portlet you will see below logs. As you can see in the logs before deploying library-portlet it will check for student-portlet.
It will build student-portlet first and then copy service jar from student-portlet into library-portlet.

18 Apr 2014 05:23:35:866 INFO  [HotDeployEvent:109] Plugin library-portlet requires student-portlet
18 Apr 2014 05:23:36:111 INFO  [HotDeployImpl:178] Deploying library-portlet from queue
18 Apr 2014 05:23:36:112 INFO  [PluginPackageUtil:1033] Reading plugin package for library-portlet
18 Apr 2014 05:23:36:928 INFO  [PortletHotDeployListener:294] Registering portlets for library-portlet
18 Apr 2014 05:23:37:079 INFO  [PortletHotDeployListener:454] 1 portlet for library-portlet is available for use

There are other usage properties available inside liferay-plugin-package.properties file
(portal-dependency-jars and portal-dependency-tlds). 
By using this properties you can use jars and tlds available Liferay portal.




Next PostNewer Post Previous PostOlder Post Home

0 comments:

Post a Comment