Blogs

Blogs

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.
 
Hi Neil first want to thank you for the great work they do LR7 and JSF.

My question is about how you should make the integration of a project service builder that use Gradle and JSF project that use maven
Hi Nestor. Thanks for the encouraging words!

You can develop a Gradle-based ServiceBuilder module using the new LR7 OSGi approach. For more info, see this article:
https://dev.liferay.com/develop/tutorials/-/knowledge_base/7-0/what-is-service-builder

And pay close attention to the paragraph at the end that states "Service Builder supports Liferay 7’s modular application development ..." along with the Blade samples.

Once the service is developed, you should be able to include the API jar as a <scope>provided</scope> dependency in your JSF Maven project's pom.xml descriptor.