Rabu, 09 Desember 2009

Configure Liferay 5.2.3 bundled with tomcat on Windows 7






According to Jonas. X Yuan on Liferay Portal Intranet Enterprise
Liferay Portal is one of the most mature portal frameworks in the market and offers many benefits. Liferay is backed by a comprehensive professional services network and it offers custom development, training, and support across the world.
As the world's leading open source portal platform, Liferay provides a unified web interface to data and tools scattered across many sources. Within Liferay portal, a portal interface is composed of a number of portlets—self contained interactive elements that are written to a particular standard. Since portlets are developed independently of the portal itself, and loosely coupled with the portal, they are apparently SOA (Service-Oriented Architecture).
In this article, i would try explain how to setup Extension Environtment for liferay development.
I wrote this article not to teach but this is what i’ve done and my personal documentation for my research just incase i forgot or my computer crashes....since i’m lame....:D

Before we start, we need external tools for this article.
1. JDK, since liferay is java base portal. We need to setup JDK in our computer. Download this JDK for free from http://java.sun.com/javase/downloads/jdk6.jsp
2. Ant, ant is free tools for most java development. Download from http://apache.eu.lucid.dk/ant/binaries/apache-ant-1.7.0-bin.zip or from ziddu....(add Link here)
3. Jikes, i use jikes 1.2.2 download from (add Link ziddu)
4. Liferay portal source 5.2.3 download from sourceforge.net
5. liferay-portal-tomcat-6.0-5.2.3 download from http://sourceforge.net/projects/lportal/files/Liferay%20Portal/5.2.3/liferay-portal-tomcat-6.0-5.2.3.zip/download
After we download all file that we need, next step is to set up Environtment Variabel. I assume that you have setup you Environtment Variabel, if not you can follow the instruction from here....(link my blog again here).
Let get it on....
Let’s assume that we will create our project in drive C:>\
Create new folder and name it “Project” (you can name it whatever you like)
Open folder “project” in explorer and create new folder and name it as “liferay”
So we have C:>\project\liferay in our windows.
We need create new folder in liferay directory. Create tomcat and portal folder.
Tomcat folder is folder that we will put all extracted file from liferay-tomcat bundled and your directory will contain extracted file showing here




To test if all configuration is right, open cmd and go to C:\project\liferay\tomcat\tomcat-6.0.18\bin>
Type startup and see what happen in your browser. If everything is set you should see liferay welcome page....



If you want to explore liferay portal, just use test@liferay as username and test as password and have fun with liferay....

Let’s start to build Ext Environtment
What is Extension Environment?
Here is brief introduction that i obtain from Liferay Portal 4 - Development in the
Extension Environment
The extension environment, also known as the ext environment, is a set of tools that allow developers to build portals and portlets on top of Liferay Portal. It can be seen as a Software Development Kit that is independent of any IDE but integrates well with all of them thanks to its usage of ant, the most popular and supported build tool. Another way to think about the extension environment is as a wrapper for Liferay's core source because, in most cases, it mirrors Liferay's core source directories (i.e. ext-impl/ for portal-impl/, ext-web/ for portal-web/). It allows you to develop on top of Liferay portal, like a platform, providing help when an upgrade to a new version of Liferay Portal is needed.

Extract liferay portal 5.2.3-src into portal folder that we create before. For easy way you can extract anywhere you like and copy all the files in the extracted folder into portal folder. Do not delete extracted folder in case we fail to build in first attemp so we can copy again without need to re-extract.
Here is what i got in my computer :


To build Ext Environment we need to create app.server.properties, build.properties and release.properties in portal folder. Keep original file and do not change the content, we can create new file and name it as app.server.{username}.properties, build. {username}.properties and release. {username}.properties. this new file will override original file when we build ext environment.
{username} is computer username, to see what exactly you computer username just open cmd and type set then you will see your username and replace {username} with your username.


e.g : my computer username is yan showing in the picture. So my file properties is app.server.yan.properties, build.yan.properties and release.yan.properties
add this line into your app.server.{username}.properties
app.server.tomcat.version=6.0.18
app.server.tomcat.dir=C:\project\liferay\tomcat\tomcat-6.0.18/tomcat
app.server.tomcat.classes.global.dir=${app.server.tomcat.dir}/lib
app.server.tomcat.lib.endorsed.dir = ${app.server.tomcat.dir}/lib/ext
app.server.tomcat.lib.global.dir=${app.server.tomcat.dir}/lib/ext
app.server.tomcat.lib.support.dir=${app.server.tomcat.dir}/lib/ext
app.server.tomcat.support.dir=${app.server.tomcat.dir}/lib/ext

add this line into your build.{username}.properties
ant.build.javac.source=1.6
ant.build.javac.target=1.6

add this line into your release.{username}.properties
lp.ext.dir=C:/project/liferay/ext
note : in app.server.{username}.properties in line app.server.tomcat.dir=C:\project\liferay\tomcat\tomcat-6.0.18/tomcat
change “C:/project/liferay/tomcat/tomcat-6.0.18/tomcat “ into your tomcat installation folder and same as release.{username}.properties.
change lp.ext.dir=C:/project/liferay/ext into you ext directory. Do not create ext directory manualy because liferay won’t be able to copy all the files needed into existing ext directory. By the way, release.{username}.properties is to tell liferay portal which directory that ext environtment is setup.
Next, open cmd and point to your portal directory. Mine is C:>\project\liferay\portal
Type this command :
ant start clean build-ext
on your console windows you should see this


Now check your ext directory in windows explorer, see what you got there....

Ok, your ext directory has created succesfully. Now time to deploy liferay from your ext environtment. To do this, you need to create app.server.{username}.properties and build.{username}.properties. since setup between portal and ext is similar, just copy app.{username}.properties and build.{username}.properties into ext folder.
Point to your ext folder in cmd, mine is C:>\project\liferay\ext
Type ant clean deploy to deploy your liferay. But before you do this, make sure that tomcat not running.


Since liferay-portal-tomcat-6.0-5.2.3 include JRE 1.5 in tomcat directory, we need to change setenv.bat in tomcat/bin and point jre home to our installed jre directory.
For testing if our configuration is correct, point your cmd into tomcat/bin and type startup. If everything ok you will see in your browser liferay welcome page and you ready to develop your portlet project in extension environment

That all my article in Building Ext Environment on Liferay – tomcat bundled 5.2.3 src

Next, i will try to write the article about setup database on mysql and liferay 5.2.3 on external tomcat 6.0

Doc Version here : http://www.ziddu.com/download/7676057/ConfigureLiferay5tomcatbundled.docx.html

Thank you

Yan Sakhrul Hadian