« Back to Liferay Faces

Generating a Liferay Faces Portlet using mvn archetype generate

Parts of this article has been incorporated into the official Liferay documentation. Refer to the section titled Developing Liferay Faces Portlets with Maven.

NOTE: My Liferay home directory was: /Users/apple/Portals/liferay.com/liferay-portal-6.1.2-jsf-2.1 So just, edit your pom.xml file and add a section like that below to complete all of the properties needed. I only needed to edit these first five properties:

  • portals.home
  • liferay.portal
  • liferay.version
  • liferay.tomcat.version
  • liferay.home

Here is my properties section:

   <liferay.app.server.lib.global.dir>${app.server.dir}/lib/ext</liferay.app.server.lib.global.dir>   <liferay.app.server.portal.dir>${app.server.dir}/webapps/ROOT</liferay.app.server.portal.dir>   <liferay.auto.deploy.dir>${liferay.home}/deploy</liferay.auto.deploy.dir>

You can view more about how to set up properties in Maven by visiting Liferay's official documentation: Using Liferay Maven Plugin Projects.

NOTE: Now we get to do some coding, yay!   So just, edit your view.xml file and add a couple of tags from the component library you chose. Put them before the closing </h:body> tag:

   <rich:calendar id="calendar" cellWidth="24px" cellHeight="22px" style="width:200px" />   
   <rich:inputNumberSpinner value="50" />

Now package the portlet war and deploy it to your Liferay Portal tomcat instance as follows:

$ mvn package
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building myPortlet Portlet 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: [[http://repository.jboss.org/nexus/content/groups/public-jboss|http://repository.jboss.org/nexus/content/groups/public-jboss]]...

... snipped for brevity ...

[INFO] WEB-INF/web.xml already added, skipping
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 22.632s
[INFO] Finished at: Fri Jan 03 11:39:50 EST 2014
[INFO] Final Memory: 12M/246M
[INFO] ------------------------------------------------------------------------
$ mvn liferay:deploy
$ # or if you do not like that:
$ cp target/myPortlet-1.0-SNAPSHOT.war /Users/apple/Portals/liferay.com/liferay-portal-6.1.2-jsf-2.1/deploy/.

You can view more about how to deploy Liferay plugins by visiting Liferay's official documentation: Deploying Liferay Plugins with Maven.

If you then add the portlet to a page on your Liferay Portal you might get this:

Thanks for trying out a Liferay Faces Portlet.

1 Attachment
Average (0 Votes)
The average rating is 0.0 stars out of 5.