Showing posts with label portlet. Show all posts
Showing posts with label portlet. Show all posts

Monday, 8 December 2014

Maven portlet development - Liferay service builder portlet


1. Navigate to the folder where you want to create Liferay plugin
2. Execute the command mvn archetype:generate. This will take some time for the first time. You might need to rerun this command for twice to get it complete.
3. It will ask to choose a number or apply filter. Enter filter for Liferay, simply type liferay and hit enter.
4. Select archetype for buil-service portlet. I.e. liferay-servicebuilder-archetype
5. Enter liferay portlet archetype version. E. g. Version of Liferay, for our case we need to choose 6.2.0-RC5.
6. Define value for property 'groupId': :org.wellOfJava.portlet. i. e. groupId will identify your project uniquely across all projects.
7. Define value for property 'artifactId': : sample-portlet. i. e. Name of the portlet. 
8. Define value for property 'version':  1.0-SNAPSHOT: : 1.0-SNAPSHOT  (or here you can just press enter)
9. Define value for property 'package':  org.wellOfJava.portlet: : org.wellOfJava.portlet. That will be package structure of your portlet.
10. Add properties tag in pom.xml after </dependencies> tag and before </project> end tag
11. Now if you open the directory you would find 2 directory created inside and one POM.xml file. This POM is parent file for both of the sab modules.
a) {portlet-name}-portlet
i. This directory contains all necessary files for Liferay portlet.
b) {portlet-name}-portlet-service
i. This directory is specifically for developing service builder classes. 
12. Now the portlet is ready to add service builder layer. You would find service.xml file in {portlet-name}-portlet\src\main\webapp\WEB-INF. Modify the file as per your requirement. 
13. Now execute following command on the parent POM.
a) mvn liferay:build-service
b) mvn clean install
14. Import the parent POM file in eclipse and both of the sub module will be imported to eclipse. As well portlet project will also have dependency for service builder jar file. 

The portlet is ready for further development. You can carry on as you develop portlet in liferay-sdk.

Monday, 8 September 2014

Spring Web Service Client Using Maven with Liferay Portlet


  • Create one simple maven base project in Eclipse.
  • Save your wsdl file in the resource directory with WSDL extension. Make sure about the extension
  • Copy following build and dependencies tag. 
<build>

    <plugins>

        <plugin>

            <groupId>org.apache.cxf</groupId>

            <artifactId>cxf-codegen-plugin</artifactId>

            <version>${cxf.version}</version>

            <executions>

                <execution>

                    <id>generate-sources</id>

                    <phase>generate-sources</phase>

                    <configuration>

                    <sourceRoot>src/main/java</sourceRoot>

                    <wsdlOptions>

                        <wsdlOption>

                            <wsdl>${basedir}/src/main/resources/TestService.wsdl</wsdl>

                        </wsdlOption>

                    </wsdlOptions>

                    </configuration>

                    <goals>

                        <goal>wsdl2java</goal>

                    </goals>

                </execution>

            </executions>

            <dependencies>

                <dependency>

                    <groupId>xerces</groupId>

                    <artifactId>xercesImpl</artifactId>

                    <version>2.9.1</version>

                </dependency>

            </dependencies>

        </plugin>

    </plugins>

</build>

    <dependencies>

        <dependency>

            <groupId>org.apache.cxf</groupId>

            <artifactId>cxf-tools-common</artifactId>

            <version>${cxf.version}</version>

        </dependency>

        <dependency>

            <groupId>org.apache.cxf</groupId>

            <artifactId>cxf-rt-frontend-simple</artifactId>

            <version>${cxf.version}</version>

        </dependency>

        <dependency>

            <groupId>org.apache.cxf</groupId>

            <artifactId>cxf-rt-transports-http</artifactId>

            <version>${cxf.version}</version>

        </dependency>

    </dependencies>

    <properties>

        <cxf.version>2.7.7</cxf.version>

    </properties>
  • build maven project “mvn clean install -DskipTests”
  • Use service class to get ServiceImplPort class. Then call your method. E.g. testService.getTestServiceImplPort().getTest();
  • In your portlet pom file. Add dependency for your maven project your have created in first step. 
  • Build your portlet with maven. Jar file for the services will be copied in the lib of portlet war file.
To Read more about CXF, Please visit http://cxf.apache.org/docs/using-cxf-with-maven.html

Thursday, 7 August 2014

Maven Portlet Development - For Command Prompt Lovers


  • Navigate to the folder where you want to create Liferay plugin
  • Execute the command mvn archetype:generate. This will take some time for the first time. You might need to rerun this command for twice to get it complete.
  • It will ask to choose a number or apply filter. Enter filter for Liferay, simply type liferay and hit enter.
  • Select proper archetype for particular pulgin e.g for Liferay portlet pulgin select liferay-portlet-archetype
  • Enter liferay portlet archetype version. E. g. Version of Liferay, for our case we need to choose 6.2.0-RC5.
  • Define value for property 'groupId': :org.wellOfJava.portlet. i. e. groupId will identify your project uniquely across all projects.
  • Define value for property 'artifactId': : sample-portlet. i. e. Name of the portlet. 
  • Define value for property 'version':  1.0-SNAPSHOT: : 1.0-SNAPSHOT  (or here you can just press enter)
  • Define value for property 'package':  org.wellOfJava.portlet: : org.wellOfJava.portlet. That will be package structure of your portlet.
  • Add properties tag in pom.xml after </dependencies> tag and before </project> end tag
  • <properties>
    <liferay.version>6.2.0-RC5</liferay.version>
    <liferay.maven.plugin.version>6.2.0-RC5</liferay.maven.plugin.version>
    </properties>
    
  • Navigate to the directory, where pom.xml of the plugin exist. Execute the command mvn clean install –DskipTests. For building war file
  • After successful build import into eclipse