Sunday, August 4, 2013

Adding liferay libraries to customized portlet classpath

When developing customized portlet in Liferay, a lot of libraries might be needed, especially open-source library. eg jstl, commons-fileupload, commons-collection, etc

Some of these libraries are being used in Liferay Portal, thus we can actually reusing it.
this can reduce the memory usage and possibilities of conflict.

Prerequisites:
1. Make sure Liferay development properly setup.

To reuse the libraries in Liferay Portal, just few steps configurations.
1. in the Liferay portlet application, open /docroot/WEB-INF/liferay-plugin-package.properties.

In Portal Dependency Jars section, is the libraries added by default from Liferay Portal during the portlet creation.

2. Click Add button to add more library from Liferay Portal.
    a dialog prompt up to show all available Jars to choose.

3. Choose any jars from the dialog > press OK.

4. verify the jars already added. either from Portal Dependency Jars or view source.

5. Save.

Once the libraries added to liferay-plugin-package.properties. then we can import the required package or class into our java class.


Done!!

No comments:

Post a Comment

LinkWithin

Related Posts Plugin for WordPress, Blogger...