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.
: 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).
: 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.