Deploy to Liferay from a Maven Project

In the Part 3 of the series will see how to deploy to Liferay from Maven Project

For a Maven plug-in project Eclipse, the project will be built as an exploded WAR file
For a Maven project the exploded WAR will be under “target” directory.
Ex; E:\MyWorkspace\adx-portlet\target

1. Create a portlet context file with the same name as your portlet in Eclipse. Liferay uses this context file in its hot deploy feature: If the Portlet name is Hello, xml will be
E:\MyWorkspace\adx-portlet\Hello.xml

Add the following to this file:

<?xml version="1.0" encoding="UTF-8"?>
<Context path="mypath"
docBase="E:/MyWorkspace/hello-portlet/target/adxportal"></Context>

2, Liferay’s has the auto-deploy feature .Create an Ant task that copies this file out to the Liferay deploy directory. Create the following Ant task and add to your build.xml or create a new build.xml for it in the base directory (E:/MyWorkspace/adx-portlet/build.xml).

<?xml version="1.0"?>
<project name = "HelloWorldPortlet" default="redeploy-my-portlet" basedir=".">
<target name="redeploy-to-Liferay">
<copy file="E:/MyWorkspace/ hello -portlet/ Hello.xml" todir="D:/liferay-portal-5.2.3/deploy"/>
</target></project>

E:/MyWorkspace/adx-portlet/target/adxportal , this is the path where the contents of the WAR is in the exploded form.

3. Run the Ant Script
Keep the Liferay running and run the Ant script which will deploy the Plugin Portlet in Liferay as an exploded WAR File

This way Liferay will run class files from with in the Eclipse workspace which will help in debugging. This will be explained in the last part of the series.

See Part 1 (Start-Stop Liferay from Eclipse) and Part 2 (Develop Spring MVC Portlet)

No comments:

Post a Comment