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

Create A Maven Project With Liferay [Technical Blog]

Published on July 23, 2014, by in Liferay.


-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


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



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.


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.


Step 9:  Enter appropriate number to create Liferay portlet.


Step 10:  Choose liferayportletarchtype version.



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



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></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“.


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”.




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





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
Comments Off on Create A Maven Project With Liferay [Technical Blog].
Copyright © 2017 - Scalsys. All Rights Reserved