Loading Audio...
Initializing Clarity's Local Developer Environment
Liferay Blade includes several essential commands for initializing and managing your local Liferay server environment. In these exercises, you’ll learn how to use these commands: blade init
, blade server init
, blade server start
, blade server stop
, and blade server restart
.
Exercise: Initializing a Workspace
As explained in the previous module, blade init
initializes a new Liferay workspace. A workspace is a structured environment for developing Liferay code projects such as modules, themes, and client extensions. Here you’ll initiate a workspace:
-
Open a new terminal window.
-
Navigate to the location where you want to create your workspace.
-
Run this command:
This should return a list of available Liferay releases.blade init clarity-liferay-workspace
-
Enter the number for the version you want to target.
-
Verify a new folder called
clarity-liferay-workspace
appears.
This is the workspace’s root folder, known asLIFERAY_WORKSPACE_HOME
.
With the workspace in place, you can initialize the local bundle.
Exercise: Initializing a Local Liferay Bundle
The blade server init
command initializes a local Liferay server in your workspace. This is the fastest way to do local development, as it eliminates dependencies on remote server availability and eliminates the risk of collisions with your teammates during active development cycles. Here, you’ll initialize the local Liferay bundle.
-
Navigate into the new workspace:
cd clarity-liferay-workspace
-
Run this command:
If this is your first time initializing this version of Liferay, this begins downloading the bundle. Subsequent initializations for this version use the local cached version.blade server init
-
Verify the build was successful:
blade server init Downloading https://services.gradle.org/distributions/gradle-8.5-bin.zip ............10%.............20%............30%.............40%.............50%............60%.............70%.............80%............90%.............100% Welcome to Gradle 8.5! Here are the highlights of this release: - Support for running on Java 21 - Faster first use with Kotlin DSL - Improved error and warning messages For more details see https://docs.gradle.org/8.5/release-notes.html Starting a Gradle Daemon (subsequent builds will be faster) > Task :downloadBundle Download https://releases-cdn.liferay.com/dxp/2024.q3.3/liferay-dxp-tomcat-2024.q3.3-1727686939.7z Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0. You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins. For more on this, please refer to https://docs.gradle.org/8.5/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation. BUILD SUCCESSFUL in 1m 37s 4 actionable tasks: 4 executed
-
Verify a new
bundles
folder appears in the workspace’s root folder. -
Navigate into the bundles folder:
This folder is equivalent of yourcd bundles
LIFERAY_HOME
. -
List the contents of this directory by executing one of the following commands.
For Mac/Linux:
ls -all
For Windows:
Take note of the folder’s contents.dir
-
Return to the workspace’s root folder:
cd ..
NOTE
Some blade commands only execute correctly if you're in the workspace’s root folder. If you get an error, double check that you are in the correct location.
With the bundle initialized, you can start up the local Liferay server.
Exercise: Managing the Local Liferay Server
The blade server start
command starts the local Liferay server in your workspace, while the blade server stop
command stops the server. Here, you’ll start and stop the server.
-
Ensure you’re in your workspace’s root folder.
-
Run this command:
blade server start
-
Go to
localhost:8080
and verify the server started successfully. This process may take a few minutes. -
Run this command:
blade server stop
-
Wait for confirmation that the server has stopped.
-
Refresh the browser page to verify the server has stopped.
Conclusion
Great! You’ve initialized a local Liferay bundle that Clarity’s team can use for development. Next you’ll configure this environment.
Capabilities
Product
Education
Contact Us