27 September, 2016

Overriding LPKG Files : Liferay DXP

Liferay provides a way to update modules without modifying the original LPKG file they're packaged in. You can do this by overriding the LPKG file.
To override a JAR or WAR from any LPKG other than the Static LPKG, 

1) first create a folder named override in the Liferay instance's osgi/marketplace folder. 2) Drop the updated JAR into this folder, making sure its name is the same as the JAR in the original LPKG, minus the version info. For example, if you want to override the com.liferay.amazon.rankings.web-1.0.5.jar from the Liferay CE Amazon Rankings.lpkg, you would insert a JAR named com.liferay.amazon.rankings.web.jar into the osgi/marketplace/override folder.
3) Overriding JARs from the Static LPKG works the same way, but the updated JARs go into the osgi/static folder instead. For example, if you want to override the com.liferay.portal.profile-1.0.3.jar, you would insert a JAR named com.liferay.portal.profile.jarinto the osgi/static folder.

Note: To undo these changes, delete the overriding JAR; portal will use the original LPKG JAR on its next startup. Note that adding and removing JARs must be done while the portal is shut down. Changes take effect the next time the portal is started.

Source : https://github.com/liferay/liferay-portal/blob/master/tools/osgi-marketplace-override-README.markdown 

I am sure this would come across someday when you would like to override LPKG files for small/large scale changes.

22 September, 2016

6.X Portlet to DXP Module Convesion

Follow below steps to convert Liferay MVC Portlet to Module:

1)  First Step is, you will have to download plugin-sdk for DXP/Liferay 7 because Liferay has provided one tool which gives you facility to show breaking API changes in your portlet.


2) Once you run this tool, it will give you all the breaking Liferay API (Not Custom code) report for Java and JSP files.
 Note: Sometimes it doesn't work to generate report. So restart your IDE and try. it should start generating report after restart.

3) Now you can modify these files according to report and can check in plugin SDK it self weather this portlet is deploy-able or not.

4) Once you are done with this activity, you will have to convert your portlet into OSGi module.

5) Create Liferay MVC Portlet from Liferay developer studio (For DXP).
Note: If your portlet have service builder code then you will have to create module by selecting service-builder template.


 6) Now what you need to do is, you will have to copy manually your java classes into generated bundle/module.




 All converted Java classes will go to java folder and all jsp/jspf files will go to resource folder under META-INF.
If you have any Language property then it will be inside content folder.

7) Once you copy your code into generated bundle, you will have to check if any dependency it required and showing any import packages error. If it is then you will have to manually define dependency inside build.gradle file.
like I have added log4j in below snippet,
dependencies {
    compileOnly group: "com.liferay.portal", name: "com.liferay.portal.kernel", version: "2.6.0"
    compileOnly group: "com.liferay.portal", name: "com.liferay.util.taglib", version: "2.0.0"
    compileOnly group: "javax.portlet", name: "portlet-api", version: "2.0"
    compileOnly group: "javax.servlet", name: "servlet-api", version: "2.5"
    compileOnly group: "jstl", name: "jstl", version: "1.2"
    compileOnly group: "org.osgi", name: "org.osgi.compendium", version: "5.0.0"
    compileOnly group: "log4j", name: "log4j", version: "2.1.17"
}

8) You also will have to make sure that, if you have used any specific imports in JSP file then you need to modify that as well. Breaking API changes tool will give you this report if its liferay specific but if you have imported some custom code then need to check manually.

9) Once you able to compile your code successfully, just deploy that converted module by running gradle deploy task.

10) Now the most important thing is, though you are able to compile module, its not guarantee that your portlet will be deployed into container successfully and available to use.
 Note:You will have to check OSGi log from gogo shell and also will have to look into tomcat log if its throwing any specific import packages error or other errors.It should be in active stage.

11) If its deploy into container without any error then, you are done with the migration.

There are couple of items or checkpoints which you will be facing during module compilation or deployment.
I will try to collect all such kind of points ans solutions and will publish into separate post.

You can post your comment here for any such kind issue which we can discuss.

Stay tune with LiferaySolution.

DB Upgrade 6.X to DXP

Image result for Liferay upgradeAs you know Liferay is moved to DXP version now and all existing Liferay customer will migrate or upgrade to newer version of DXP.


Here in these series of  blogs, you will see all step by step guide which will help you to follow all the necessary steps for the migration to DXP.

As a part of migration/up-gradation, Database comes first everywhere which you must require to migrate to make it compatible with new version.

Here we will only talk about migration from 6.X to DXP as we will not consider the older version like 5.X.


20 September, 2016

Liferay DXP Setup



Image result for Liferay DXP
Follow below steps to setup local Liferay DXP :

Below Tools and software are required to setup Liferay DXP in local machine  :
A.    JDK-8
B.    JPM
C.    Blade
D.    Liferay DXP (Tomcat bundle)
E.    Liferay Plugin-SDK


Popular Posts

Featured Post

Liferay 7.3 compatibility matrix

Compatibility Matrix Liferay's general policy is to test Liferay Portal CE against newer major releases of operating systems, open s...