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. - 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:
-
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. -
Verify the build was successful:
- Verify a new
bundles
folder appears in the workspace’s root folder. -
Navigate into the bundles folder:
This folder is equivalent of yourLIFERAY_HOME
. -
List the contents of this directory by executing one of the following commands.
For Mac/Linux:
For Windows:
Take note of the folder’s contents. -
Return to the workspace’s root folder:
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:
- Go to
localhost:8080
and verify the server started successfully. This process may take a few minutes. -
Run this command:
- 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