- Download Liferay binary here. I downloaded the Tomcat bundle for ease of configuration. YMMV with other bundles.
- Follow the quick installation here. I didn’t have any issue starting Tomcat with Liferay. It brings up the default portal page automatically. Do not close this page. We will revisit this page in a later step.
- Download SDK from here. Look for a download link that starts with “Liferay Plugins SDK”.
- If you don’t have Ant setup in your environment, follow the instructions in page 6 of the development documentation here. My environment is already setup with ant, so I just skipped this step.
- Customize your own
build.${username}.properties
. I made copy of${sdk_directory}/build.properties
and created my own file in the same directory using thebuild.${username}.properties
convention documented in page 7 of the development guide. Within this file, I updatedapp.server.dir
property with the path to Tomcat’s directory in my local environment. The document has a typo about the other property:java.compiler
. Reading thebuild.property
file suggested to me that the property name should bejavac.compiler
. Since I only wanted the default configuration, which ismodern
, I didn’t change this second property. - Create a portlet using ant: I followed the instruction on page 8 in the development guide. It is very straight forward. Make sure you run the create command in the portlets directory in the sdk directory.
cd ${sdk_directory}/portlets
ant -Dportlet.name=hello -Dportlet.display.name="hello world title" create - After created the portlet, you should see a new directory that looks like
hello-portlet
. You can go into that directory and make changes to your liking. Since my goal was just to get a simple portlet running, I just added “Hello World” tohello-portlet/docroot/view.jsp
file. - Deploy the portlet: Within the
hello-portlet
, I ran the following command to deploy the portlet:ant deploy
- After I deployed the portlet, I did a quick check in the log file (
catelina.out
) to see if the portlet is available. I did notice that the message is slightly different from what development guide stated. - Add the portlet to the portal page: I returned to the default portal page on my browser. On the default portal page, there is a menu that has the label “welcome” on the to right corner. Liferay documentation called this “Dock”. If you mouse over this, you will see login option. To login, enter “bruno@7cogs.com” for email address and “bruno” for password. This information comes from the quick installation guide. All other documentation that I read all refers to “test@liferay.com” and “test”, which are wrong for the release that I downloaded. Once log-in, You can mouse over to the Dock and choose “Add Application”. Enter the name of your portlet in the search textfield, the list should automatically updated. If you can identify your portlet, click the “Add” link next to it. You should see the portlet showing on the portal page.
Friday, October 14, 2011
Hello World Example in Liferay
9:40 PM
No comments
0 comments:
Post a Comment