Course Environment Setup

Throughout this course, you’ll use a local Liferay environment to implement Clarity’s solutions. Here you’ll prepare your system and set up the Clarity workspace you’ll use in course exercises.

Prerequisites

Ensure your system satisfies the following prerequisites:

  • Git
  • Java JDK 21
  • Blade CLI

Git

To verify Git is installed and ready for use, open a terminal window and run this command:

git version
NOTE
If you’re on Windows, use Command Prompt, PowerShell, or BASH to execute terminal commands.

This returns the version of your git installation. For example,

git version 2.45.2

If the Git command is not found, please see official documentation for how to install Git for your OS (macOS|Windows|Linux/Unix).

Java JDK 21

This course requires Java JDK 21. You can find the appropriate OpenJDK distribution for your OS here. You can download the JDK as a ZIP (Windows) or TAR.GZ (Linux/Mac) package. To install, extract the file in a folder of your choice, then set the JAVA_HOME environment variable to that folder. Alternatively, you can install Java using native installers according to your OS (macOS|Windows|Linux).

Once you've installed Java JDK 21, open a terminal window and run this command to ensure it is ready for use:

java -version

The JDK version appears. For example,

openjdk version "21.0.4" 2024-07-16
OpenJDK Runtime Environment (Red_Hat-21.0.4.0.7-2) (build 21.0.4+7)
OpenJDK 64-Bit Server VM (Red_Hat-21.0.4.0.7-2) (build 21.0.4+7, mixed mode, sharing)

If it does not, you may need to perform additional troubleshooting steps that are beyond the scope of this course. Please see the relevant Java JDK installation documentation for your system.

Blade CLI

Liferay provides Blade CLI to simplify many development tasks. You can use it to create new workspaces, get server bundles, spin up Liferay instances, and more. For this course, Blade is strongly recommended. Before proceeding, see Blade CLI for installation instructions.

Once finished, run this command to verify Blade is installed and ready to use:

blade version

It should return the CLI’s version:

blade version 7.0.3.202503050337

If the output indicates there is a newer version, run this command to update it:

blade update

Great! With the prerequisites in place, let’s set up your Liferay environment.

Setting Up the Clarity Workspace

As explained in the previous lesson, you'll help implement Clarity's solutions throughout this course. Instead of starting from scratch, you'll use a partially complete solution provided in a Liferay workspace: liferay-course-backend-client-extensions.

This workspace includes two GitHub branches:

  • main: This is the course’s starting branch and is intended for course exercises.
  • final: This branch includes the final result of course exercises.

Workspace Setup for Course Exercises

Here you’ll set up the workspace locally in preparation for the course exercises.

  1. Open your terminal and clone the training workspace to your computer:
    git clone https://github.com/liferay/liferay-course-backend-client-extensions
    This saves a copy of the project in your current terminal directory.
    IMPORTANT
    If you've cloned the repo previously, ensure your workspace is up to date by running git pull origin main.
  2. Go to the workspace's root folder in your terminal:
    cd liferay-course-backend-client-extensions
  3. Initialize your Liferay bundle.
    blade server init
    
    This downloads and builds dependencies for running Liferay, including the Liferay Tomcat server.
    If you don't have Blade installed, run the correct gradlew command for your OS:
    Unix-based:
    ./gradlew initBundle
    Windows:
    .\gradlew.bat initBundle
    
  4. Use Blade to start your Liferay server:
    blade server run
    
    Alternatively,
    Unix-based:
    ./bundles/tomcat/bin/catalina.sh run
    
    Windows:
    .\bundles\tomcat\bin\catalina.bat run

    Wait until you see org.apache.catalina.startup.Catalina.start Server startup in [x] milliseconds to indicate startup completion.

    NOTE
    You may notice some errors during your initial startup (e.g., reindexing). You can safely ignore these errors.
  5. When finished, access your Liferay DXP instance by going to localhost:8080 in your browser.

  6. Sign in using these credentials:

    • Username: admin@clarityvisionsolutions.com
    • Password: learn
  7. Take some time to explore the site and resources included in the training workspace.

Exploring the Course's Final Result (Optional)

If you're interested in exploring the course’s final result, follow these steps:

  1. Open your terminal and navigate to the workspace’s root folder.

  2. Run this command to switch to the final branch:

    git checkout final

    This branch contains the completed exercises and auto-deploys the required client extensions.

  3. Follow steps 3-9 of the previous section to initialize and start the bundle.

  4. Take some time to explore the finalized site.

Conclusion

Great! With your environment set up, you're ready to start contributing to Clarity's applications. Next, you'll start learning the fundamentals of migrating data and configurations with client extensions.

Loading Knowledge

Capabilities

Product

Education

Contact Us

Connect

Powered by Liferay
© 2024 Liferay Inc. All Rights Reserved • Privacy Policy