Home Liferay Create A Maven Project With Liferay [Technical Blog]
formats

Create A Maven Project With Liferay [Technical Blog]

Published on July 23, 2014, by in Liferay.

Prerequisite:

-Maven installed.

 

Liferay provides many maven archetypes to help create Maven projects for multiple plugin types, including portlet, theme, hook, and layout template plugins. Liferay provides archetypes for each of these plugin types for different versions of Liferay. Choose here best Liferay Portal Development Company.

Maven Setup:

  • Download Apache Maven

                        http://maven.apache.org/download.cgi#Installation bin zip file

  • Download Maven Liferay Portal from below mentioned link

                        http://sourceforge.net/projects/lportal/files/Liferay%20Portal/6.2.1%20GA2/liferay-portal-maven-6.2-ce-ga2-  20140326112342532.zip/download

  •  Download Liferay Maven Support for URL

                       https://github.com/liferay/liferay-maven-support

  •  Download Liferay Portal 6.2 CE GA2(tomcat) from URL

                       http://sourceforge.net/projects/lportal/files/Liferay%20Portal/6.2.1%20GA2/liferay-portal-tomcat-6.2-ce-ga2-20140319114139101.zip/download

 

Step 1:   Unzip the Liferay Maven zip file.

Step 2:   Open Command prompt from the home directory of the Liferay Maven unzipped folder.

                                Ex: D:\projects\demo\liferay-portal-maven-ce-ga2\

                                Open cmd and go to “Liferay-portal-maven-ce-ga2″ folder

Step 3:   Execute “ant install” command to install Liferay portal maven dependency into your maven local repository.

Step 4:   Unzip Liferay maven support, zip file.

Step 5:   Open CMD from from extracted Liferay maven support zip.

Step 6:   Execute “mvn install” command to install Liferay maven archetype into maven repository.

Step 7:   Check the installation, run in a dos command “mvn archetype:generate“.

                               You will see the many maven archetype.

                        1

Step 8:  To create Liferay Maven portlet you have to choose “liferayportlet-archetype“. Filter Liferay archetype by typing keyword “liferay“. You will see only Liferay related maven archetype.

                       2

Step 9:  Enter appropriate number to create Liferay portlet.

                     3

Step 10:  Choose liferayportletarchtype version.

                    4

5

Step 11: Create Liferay portlet from a Maven archetype and command line.

                     groupId:com.test
                     artifactId:test
                     version:1.0-SNAPSHOT
                     package:com.test

6

Step 11:  Open pom.xml file of test and add below properties after version tag.

<properties> <liferay.version>6.2.1</liferay.version> <liferay.maven.plugin.version>6.2.10.6</liferay.maven.plugin.version> <liferay.auto.deploy.dir>D:\projects\demo\runtime\deploy</liferay.auto.deploy.dir> <liferay.app.server.deploy.dir>D:\projects\demo\runtime\tomcat-                     7.0.42\webapps</liferay.app.server.deploy.dir> <liferay.app.server.lib.global.dir>D:\projects\demo\runtime\tomcat-     7.0.42\lib\ext</liferay.app.server.lib.global.dir> <liferay.app.server.portal.dir>D:\projects\demo\runtime\tomcat-7.0.42\webapps\ROOT</liferay.app.server.portal.dir> </properties>

Step 12: Add Liferay repository in the pom.xml file.

<repositories> <repository> <snapshots> <enabled>false</enabled> </snapshots> <id>liferay</id> <name>Liferay Nexus</name> <url>https://repository.liferay.com/nexus/content/groups/liferay-ce</url> </repository> </repositories>

Step 13: Start Liferay tomcat using the startup.bat file.startup.bat file located under “{LIFERAY_HOME}\tomcat-{tomcat-version}\bin” folder.

Step 14:  Open cmd and go to project folder and execute command “mvn clean install liferay:deploy“.

8

Step 15:  Once you will see “BUILD SUCCESS” message, then check your Liferay console you will see message “1 portlet for test-1.0-SNAPSHOT is available for use”.

7

9

 

Step 16: Open browser, type localhost:8080 and add portlet in page.

10

 

 

11

Share!Share on FacebookShare on Google+Share on LinkedInTweet about this on TwitterFlattr the authorDigg thisPin on PinterestEmail this to someoneShare on StumbleUponShare on RedditShare on TumblrBuffer this pagePrint this page
Tags:
Comments Off on Create A Maven Project With Liferay [Technical Blog].
Copyright © 2017 - Scalsys. All Rights Reserved