Friday 19 April 2013

Use of bean shell in liferay.


In the control panel -server-serveradministrator we have various tabs. In this tabs we have scripts.
In this we have various languages in the drop down. One language is bean shell.

It is used to execute the the java code directl. Like we want to get all the users or want to update user information we can do directly by bean shell.

Example: From the code snippet we are getting the user first name directly.

Maven based portlet in liferay.


Hi All,

Here we have a first example to make a maven based portlet in liferay. To make a maven based portlet first we need to configure maven.

1> Install the maven into your system

2> Set the System variable MAVEN_HOME like C:\Program Files\apache-maven-2.2.1

3> Add the path of the bin folder in to the Path into the system variable.  %MAVEN_HOME%\bin;

4> Now we need to make a maven repository where all the dependencies jar will be saved.To make this need to make a repository folder and need to give path of that folder into the c:/.m2/settings.xml

1:   <?xml version="1.0"?>  
2:      <settings>  
3:        <localRepository>D:/maven</localRepository>  
4:      </settings>  

   Here mention the central repository where all dependencies jar will be exist.

    In some case the .ms folder doesn,t exist you need to make it in the user folder using following folder

    md c:\Users\aalap.desai\.m2

5> Now mvn instalation has been completed now make a maven base portlet.

6>Form command prompt execute the command :mvn archetype:generate
    On the command prompt get the archtype for maven.

     

7> Select the option which kind of the liferay plugin package need to make.  Here we have a option to         make  hook,portlet,portlet with service builder etc.

8> Lets take a example to make a portlet have a use of service builder. For this we need to select the option           57.
9> It will ask for the version of the liferay you want to make the portet. Example: 6.1.20 I have selected 4
    then it will ask for the groupId,artifactId,snapshot-version.
10> After that it will     ask for conformation. Once you have confirm it will the folder with the name maven which has two folder one is maven-portlet and another is maven-portlet-service

11> In this manually need to amke the entry of

    abvoe the</projet> tag.

12> In maven-portlet src > main > webapps > web-inf > service.xml

13> Make the entity change you want to make you can make and execute the command -->> mvn liferay:build service.
    All the appropriate classes will be generated

14> Attached a sample maven portlet.
Maven sample portlet


Please let me know if any help is needed. Please let me know if I have missed anything.