Friday, June 10, 2011

Setup Liferay Development Environment | Install Liferay Plugin SDK

Share |
If you want to develop plugins (portlet, theme, hook, ext, layout template) for Liferay to customize Liferay, you need to install plug-in SDK for Liferay. You can download Liferay plugin SDK form http://www.liferay.com/downloads/liferay-portal/available-releases

Requirements and steps to install Liferay Plugins SDK
- You must have JDK 1.5 or higher installed on your machine
- You must have already installed Liferay portal with any Application server. (Note: visit here for guidelines of installed Liferay portal)
- Make sure you download Liferay portal and Liferay Plug-in SDK with same version
- Now create "plugins" or "liferay-plugins" directory at the same level where <liferay portal directory> is located. e.g. if Liferay portal is installed at C:\liferay\liferay-portal-X.X.X then create directory C:\liferay\plugins and extract the content of liferay-plugins-sdk-X.X.X.zip into C:\liferay\plugins directory.
- This will install Liferay plugins SDK / Liferay development environment into your machine.

Setup / customize Liferay Plugin SDK build properties based on your application server
- Once you finish installation of Liferay Plugin SDK, you can go to its installation directory, e.g. C:\liferay\plugins. Here you can find file build.properties, you can either edit this file directly or preferably create copy of this file with name build.<username>.properties (e.g. my username is tejash then I will create copy of the file with name build.tejash.properties)
- Then edit the newly created build.<username>.properties by default content of this file would be as follows:

 
##
## DO NOT EDIT THIS FILE.
##
## To update the properties of this file, create a separate properties file
## named "build.${user.name}.properties" with the properties to overwrite.
##

##
## Application Server
##

    #
    # The default settings are for Tomcat. Additional settings are left
    # commented out as examples.
    #

    #
    # Specify the paths to an unzipped Geronimo bundle.
    #
    #app.server.type=geronimo
    #app.server.dir=${project.dir}/../bundles/geronimo-2.2.0
    #app.server.deploy.dir=${app.server.dir}/deploy
    #app.server.lib.global.dir=${app.server.dir}/var/shared/lib
    #app.server.portal.dir=${app.server.dir}/deploy/liferay-portal.war

    #
    # Specify the paths to an unzipped Glassfish bundle.
    #
    #app.server.type=glassfish
    #app.server.dir=${project.dir}/../bundles/glassfish-3.0.0
    #app.server.deploy.dir=${app.server.dir}/autodeploy
    #app.server.lib.global.dir=${app.server.dir}/domains/domain1/lib
    #app.server.portal.dir=${app.server.dir}/domains/domain1/applications/liferay-portal

    #
    # Specify the paths to an unzipped JBoss bundle.
    #
    #app.server.type=jboss
    #app.server.dir=${project.dir}/../bundles/jboss-5.1.0
    #app.server.deploy.dir=${app.server.dir}/server/default/deploy
    #app.server.lib.global.dir=${app.server.dir}/server/default/lib/ext
    #app.server.portal.dir=${app.server.dir}/server/default/deploy/ROOT.war

    #
    # Specify the paths to an unzipped Jetty bundle.
    #
    #app.server.type=jetty
    #app.server.dir=${project.dir}/../bundles/jetty-6.1.23
    #app.server.deploy.dir=${app.server.dir}/webapps
    #app.server.lib.global.dir=${app.server.dir}/lib/liferay
    #app.server.portal.dir=${app.server.dir}/webapps/root

    #
    # Specify the paths to an unzipped JOnAS bundle.
    #
    #app.server.type=jonas
    #app.server.dir=${project.dir}/../bundles/jonas-5.1.1
    #app.server.deploy.dir=${app.server.dir}/deploy
    #app.server.lib.global.dir=${app.server.dir}/lib/ext
    #app.server.portal.dir=${app.server.dir}/deploy/liferay-portal.war

    #
    # Specify the paths to an unzipped Resin bundle.
    #
    #app.server.type=resin
    #app.server.dir=${project.dir}/../bundles/resin-3.1.9
    #app.server.deploy.dir=${app.server.dir}/webapps
    #app.server.lib.global.dir=${app.server.dir}/ext-lib
    #app.server.portal.dir=${app.server.dir}/webapps/ROOT

    #
    # Specify the paths to an unzipped Tomcat bundle.
    #
    app.server.type=tomcat
    app.server.dir=${project.dir}/../bundles/tomcat-6.0.26
    app.server.deploy.dir=${app.server.dir}/webapps
    app.server.lib.global.dir=${app.server.dir}/lib/ext
    app.server.portal.dir=${app.server.dir}/webapps/ROOT

##
## Auto Deploy
##

    #
    # Plugins will be deployed to this directory. Make sure that Liferay is
    # also set to scan this directory.
    #
    auto.deploy.dir=${app.server.dir}/../deploy

##
## Compiler
##

    ant.build.javac.source=1.5
    ant.build.javac.target=1.5

    javac.compiler=modern
    #javac.compiler=org.eclipse.jdt.core.JDTCompilerAdapter

    javac.debug=on
    javac.deprecation=off
    javac.fork=true
    javac.memoryMaximumSize=256m
    javac.nowarn=on

##
## Database
##

    #
    # Set the database name used by the SQL scripts.
    #
    database.name=lportal

    #
    # Set the database server types to build SQL scripts for.
    #
    database.types=db2,derby,firebird,hypersonic,informix,ingres,interbase,jdatastore,mysql,oracle,postgresql,sap,sqlserver,sybase
    #database.types=mysql

##
## Extension Environment
##

    #ext.work.dir=

##
## Libraries
##

    required.portal.jars=commons-logging.jar,log4j.jar,util-bridges.jar,util-java.jar,util-taglib.jar

##
## Operating Systems
##

    os.apple=Mac OS X
    os.unix=Linux,FreeBSD,Solaris,SunOS
    os.windows=Windows 95,Windows 98,Windows NT,Windows 2000,Windows 2003,Windows XP,Windows Vista,Windows 7

##
## Plugins
##

    #
    # Set the excludes and includes attributes. These attributes are read when
    # you run "ant" from the layouttpl, portlets, or themes directory. By
    # default, the ant task will go through every subdirectory. Setting these
    # attributes can limit it to just the plugins you're working on.
    #
    plugins.excludes=
    plugins.includes=*

##
## SVN
##

    svn.enabled=false

##
## Version
##

    #
    # Set the version of Liferay Portal that these plugins are designed for.
    #
    lp.version=6.0.6

- In this file lines starting with # are comments and non-commented line represents properties for build Liferay Plugins
- You need to set following properties based on you application server

 
    app.server.type
    app.server.dir
    app.server.deploy.dir
    app.server.lib.global.dir
    app.server.portal.dir

Which is configured by default for Liferay with Tomcat Application server as follows:

 
    app.server.type=tomcat
    app.server.dir=${project.dir}/../bundles/tomcat-6.0.26
    app.server.deploy.dir=${app.server.dir}/webapps
    app.server.lib.global.dir=${app.server.dir}/lib/ext
    app.server.portal.dir=${app.server.dir}/webapps/ROOT

For Liferay with tomcat application server you need to change only app.server.dir to point to tomcat directory of Liferay portal and every thing works well. In my case I installed liferay-portal-6.0.6 with Tomcat 6.0.26 at c:\liferay, hence I will set value of app.server.dir to c:/liferay/liferay-portal-6.0.6/tomcat-6.0.26 and the changed values in build properties files should look like:

 
    app.server.type=tomcat
    app.server.dir=c:/liferay/liferay-portal-6.0.6/tomcat-6.0.26
    app.server.deploy.dir=${app.server.dir}/webapps
    app.server.lib.global.dir=${app.server.dir}/lib/ext
    app.server.portal.dir=${app.server.dir}/webapps/ROOT


Note: Always user "/" for specifying path in build.properties file even if you are working on Windows platform.

Also build properties file has commented lines which contains properties need to be set for other application servers, you can comment the default configuration properties for tomcat and remove comments for the required application server and also need to set correct value of app.server.dir to home directory of your application server.
e.g For Liferay with JBOSS, I will comment all the line with tomcat configuration and uncomment JBOSS related configuration and modify them as follows:

# JBOSS related configuration
    app.server.type=jboss
    app.server.dir=c:/liferay/liferay-portal-6.0.6/jboss-5.1.0
    app.server.deploy.dir=${app.server.dir}/server/default/deploy
    app.server.lib.global.dir=${app.server.dir}/server/default/lib
    app.server.portal.dir=${app.server.dir}/server/default/deploy/ROOT.war

# commented original configuration for tomcat
    #app.server.type=tomcat
    #app.server.dir=${project.dir}/../bundles/tomcat-6.0.26
    #app.server.deploy.dir=${app.server.dir}/webapps
    #app.server.lib.global.dir=${app.server.dir}/lib/ext
    #app.server.portal.dir=${app.server.dir}/webapps/ROOT


Similarly you can change build properties file for different application servers.
Share |

1 comment:

  1. Hi, thanks for this post, your jboss config helped me to solve a probleme on my installation.

    ReplyDelete