You can generate a Liferay Faces application without having to create your own folder structure, descriptor files, and such manually. If you really want to do that manually, you can examine the structure of a JSF application and create one from scratch in the Creating a JSF Project Manually tutorial.
Before generating your JSF application, you should first visit liferayfaces.org, a great reference spot for JSF application development targeted for Liferay DXP. This site lets you choose the options for your JSF application and generates a Maven archetype command you can execute to generate an application with your chosen options. You can select the following archetype options:
- Liferay Portal Version
- JSF Version
- Component Suite
You can also choose a build framework (Gradle or Maven) and have a list of
dependencies generated for you and displayed on the page. The dependencies are
provided to you on the site page in a
depending on the build type you selected. This is useful because it gives you an
idea of what dependencies are required in your JSF application before generating
Note: Gradle developers can also use the
because it generates both a
build.gradle and a
pom.xml file for you to use.
Next you’ll generate an example JSF application (e.g., Liferay Portal 7 + JSF 2.2 + JSF Standard) via command line using liferayfaces.org.
Navigate to liferayfaces.org and select the following options:
- Liferay Portal: 7
- JSF: 2.2
- Component Suite: JSF Standard
Copy the archetype generation command and execute it. Make sure you’ve navigated to the folder where you want to generate your project.
That’s it! Your JSF application is generated in the current folder!
You can also generate a Liferay JSF application using Maven’s interactive
archetype UI. To do this, execute
mvn archetype:generate -Dfilter=liferay and
select the JSF archetype you want to use. Then you’ll step through each option
and select the version, group ID, artifact ID, etc. To learn more about this,
Generating New Projects Using Archetypes
Once you have your JSF application generated, you can import it into Liferay Dev Studio DXP and develop it further. To deploy it to your Liferay DXP instance, drag and drop it onto the Liferay DXP server.
You can build the project and deploy it to Liferay DXP from the command line too! If you’re using Gradle, run the following command to build your JSF application:
For Maven, execute the following command:
Then copy the generated WAR to Liferay DXP’s
[cp|copy] ./com.mycompany.my.jsf.portlet.war LIFERAY_HOME/deploy
Awesome! You’ve generated your JSF application and deployed it using the command line.