New Maven Archetypes for JSF Portlets

UPDATE: September 2, 2016 - Visit www.liferayfaces.org for a convenient web page that helps you determine your archetype:generate command and/or required dependencies.

The Liferay Faces team is working on production support for JSF portlets in Liferay Portal 7.0 and Liferay DXP. As part of this effort, we have developed some archetypes for use with Maven 3.

For a plain JSF portlet, type the following at the command line:
mvn archetype:generate \
  -DgroupId=com.mycompany \
  -DartifactId=com.mycompany.my.jsf.portlet \
  -DarchetypeGroupId=com.liferay.faces.archetype \
  -DarchetypeArtifactId=com.liferay.faces.archetype.jsf.portlet \
  -DarchetypeVersion=5.0.0 \
  -DinteractiveMode=false
For a PrimeFaces portlet, type the following:
mvn archetype:generate \
  -DgroupId=com.mycompany \
  -DartifactId=com.mycompany.my.primefaces.portlet \
  -DarchetypeGroupId=com.liferay.faces.archetype \
  -DarchetypeArtifactId=com.liferay.faces.archetype.primefaces.portlet \
  -DarchetypeVersion=5.0.0 \
  -DinteractiveMode=false
For a Liferay Faces Alloy portlet, type the following:
mvn archetype:generate \
  -DgroupId=com.mycompany \
  -DartifactId=com.mycompany.my.alloy.portlet \
  -DarchetypeGroupId=com.liferay.faces.archetype \
  -DarchetypeArtifactId=com.liferay.faces.archetype.alloy.portlet \
  -DarchetypeVersion=5.0.0 \
  -DinteractiveMode=false
For an ICEfaces portlet, type the following:
mvn archetype:generate \
  -DgroupId=com.mycompany \
  -DartifactId=com.mycompany.my.icefaces.portlet \
  -DarchetypeGroupId=com.liferay.faces.archetype \
  -DarchetypeArtifactId=com.liferay.faces.archetype.icefaces.portlet \
  -DarchetypeVersion=5.0.0 \
  -DinteractiveMode=false
For a RichFaces portlet, type the following:
mvn archetype:generate \
  -DgroupId=com.mycompany \
  -DartifactId=com.mycompany.my.richfaces.portlet \
  -DarchetypeGroupId=com.liferay.faces.archetype \
  -DarchetypeArtifactId=com.liferay.faces.archetype.richfaces.portlet \
  -DarchetypeVersion=5.0.0 \
  -DinteractiveMode=false

Liferay IDE / Liferay Developer Studio

If you are developing your JSF portlets with Eclipse for Java EE Developers, you can install the Liferay IDE pluginsOtherwise, if you are developing with Liferay Developer Studio, the plugins are installed by default.
After your project is created with the mvn archetype:generate command, you can import the project into Eclipse using the following steps:
1. Click File -> Import ...
2. Expand the "Maven" category
3. Click on "Existing Maven Projects" and click Next
4. Enter the full directory path to your newly created project
5. Click Finish
 
In order to deploy the portlet, simply drag the project to the "Liferay 7" or "Liferay DXP" server in the Servers pane.
 

Write a blog post too!

Write a deep dive into how you use Liferay projects in your technology stack. Or let people know useful tips and tricks for a particular functionality. The Liferay community needs you!

Login or Create an account