You may have several reasons for downloading and building Liferay Faces from its project source code:
- To try out the latest cutting edge changes
- To investigate a suspected bug
- To learn how Liferay Faces is implemented
For this tutorial, you’ll learn how to access the Liferay Faces source code and build it yourself. The Liferay Faces source code is organized into several different Github repositories:
- liferay-faces-alloy
- liferay-faces-bridge-api
- liferay-faces-bridge-ext
- liferay-faces-bridge-impl
- liferay-faces-maven
- liferay-faces-portal
- liferay-faces-showcase
- liferay-faces-util
First, you’ll start with installing a Liferay Faces project.
Installing a Liferay Faces Project
It’s important to install the version of Liferay Faces that you want. So, it’s a good idea to check the Liferay Faces Version Scheme to confirm the version of Liferay Faces.
You can either install the project by cloning it from GitHub or by downloading
it as a .zip
file. Both options are demonstrated below.
Cloning the project from GitHub
Cloning the project requires that you set up Git on your machine. Once you’ve set up Git, you can download a Liferay Faces project from GitHub and work with a particular branch of the project, following these instructions:
-
Execute the following command from your terminal:
git clone https://github.com/liferay/liferay-faces-[PROJECT]
Replace the
[PROJECT]
variable with the Liferay Faces project you desire (e.g.,liferay-faces-bridge-impl.
). -
Navigate into that directory by executing
cd liferay-faces-[PROJECT]
. -
Checkout the branch (
master
is the default branch) you want to use.For example, to use the 3.x version of source code, execute the following command:
git checkout 3.x
Downloading the project as a .zip
file
To download the Liferay Faces project as a .zip
file, follow these
instructions:
-
Visit the Liferay Faces project’s Github page.
-
Click on the branch drop-down menu and select the branch or tag for the version of the project that you’d like to use.
-
Click on the Clone or download → Download ZIP button on that right side of the page to download the
[branch/tag name].zip
file for that branch or tag. -
Extract the
.zip
file contents to a location on your machine. -
In a terminal window, navigate into the Liferay Faces project’s root directory:
cd liferay-faces-[PROJECT]
Now that you’ve installed the Liferay Faces project, you can configure your environment for building the project. In the next section of this tutorial, you’ll explore building Liferay Faces with Maven.
Building Liferay Faces with Maven
Maven is required to build the Liferay Faces project. You can download Maven
from
http://maven.apache.org/download.cgi. It
is recommended to place your Maven installation’s bin
directory in your
system’s $PATH
, so you can run the Maven executable (mvn
) easily from your
terminal.
-
Some Liferay Faces project should rely on Liferay’s repository to download Maven artifacts over using Maven Central. To configure your Liferay Faces project to download from Liferay’s repo, add the following code snippet to your
$HOME/.m2/settings.xml
file:<repositories> <repository> <id>liferay-public</id> <url>https://repository.liferay.com/nexus/content/groups/public</url> </repository>
If a
settings.xml
file does not exist in your$HOME/.m2
folder, create it and add the code snippet. -
Make sure you’re in your Liferay Faces project directory and, then, build the source with Maven by executing the following command:
mvn clean package
Maven builds the Liferay Faces artifacts contained in that project. For example,
running mvn clean package
in the root folder of the
liferay-faces-bridge-impl
project produces the
bridge-impl/target/liferay-faces-bridge-impl-[version].jar
. Artifacts
generated in other Liferay Faces projects follow a similar folder path.
That’s it; you’ve built Liferay Faces from source!
Related Topics
Creating and Deploying JSF Portlets