How to deploy portlets to Liferay?

2019-01-17 22:46发布

问题:

I have faced problems in trying to install new portlets to Liferay running on Glassfish domain. I figured out the flow very lately and want to share it with others also. So, please read the answer and hope this helps someone :)

(Pre requisites for the problem is that I knew that adding projects running on Glassfish is done with a autodeploy folder, but making them visible on Liferay was another story.)

回答1:

So, you make first a .war file let's say a portlet of name your_file.war. You wanna have it running on a glassfish domain under Liferay portal.

Steps to success:

1) Navigate to Control Panel -> Plugins Installation on Liferay
2) hit Install new portlets
3) hit Configuration
4) Fill in to Deploy Directory a new place for deployment let's say [your domain]/autodeploy2
5) Check that in the next line target is [your domain]/autodeploy (it is the Glassfish default deployment directory)
6) hit save

Now deployment will be done by copy pasting files to that new directory [your domain]/autodeploy2. The rest of it is handled automatically. Setting takes action imediatedly.

Done with deployment: Make a victory jig and enjoy :)

..you stop dancing and face a bug. You want a new revision to be deployed.. In this case, continue reading.

So, you have built your war again and want to re-deploy. Do the following:

1) undeploy old stuff from (your domain)/autodeploy folder by deleting the war file. Don't delete any other file.

2) result is that your_file.war_UnDeployed file will appear.

3) deploy new file by copying the newly built war in (your domain)/autodeploy2 folder.

4) result is that your_file.war_deployed will appear in (your domain)/autodeploy folder.

Make a dance again :)



回答2:

There is several methods to deploy plugins (portlets, hooks, filters...) into your Liferay Portal.

If you're using Administration you can do it as Mico descripted. but if you're using Maven, Gradle, Ant, Ivi... you can configure their deployment descriptors and redirect their outputs (that are the wars) to the hotdeploy server folder (If you're using Tomcat, JBoss, Glassfish...).

This approach is quite better because you can create backup webapp folder and restore it whenever you want easily.



回答3:

Below are not for Glassfish but common startup steps:

To install a portlet in lliferay portal

• first install liferay portal from below link http://www.liferay.com/en_GB/community/wiki//wiki/Main/Liferay+IDE+Getting+Started+Tutorial

this requires installation of
    liferay ide
    liferay portal bundled with tomcat
    add this tomcat as run server time and start it, it will start liferay portal 

• create a portlet application

• open liferay at localhost:8080 and goto Admin -> control panel

• goto Plugins Configuration

• goto Intall tab and give location of war file (some logging error might come at tomcat console, ignore it)

• again goto home page at localhost:8080 and click + button

• go at the bottom in the list and u will find ur portlet

• click add button present at the right side of it and ur portlet would be added to the page.

Modifying code of portel requires to uninstall and install again the portlet from war file. All existing added portlets would also be modified.