Mastering Liferay Workspaces and Tooling

Course Overview

Setting Up Local Bundles

When setting up working environments, configuring your local bundle is essential. This provides a dedicated Liferay DXP instance for efficient development, testing, and debugging. There are two primary areas for managing local bundle configurations in your Liferay workspace:

  1. The gradle.properties file in workspace’s root folder
  2. The configuration files in the workspace’s  /configs/[environment] folder

Since the configs folder was covered in the previous module, here you’ll take a closer look at the gradle.properties file.

Initializing Local Bundles

As explained in the previous module, the blade server init command initializes a local Liferay server within your Liferay workspace. This command downloads the Liferay the server and configures it for local development. You can only run this command from the workspace’s root folder.

When you run blade server init for the first time with a specific Liferay version, this begins downloading the bundles folder that contains the Liferay server.

blade server init
Starting a Gradle Daemon (subsequent builds will be faster)

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 39s
3 actionable tasks: 3 executed

By default, this creates the bundles folder is the workspace’s home folder. To configure this and other behaviors, you can edit the workspace’s gradle.properties file.

Configuring Gradle Properties for Local Bundles

Each workspace's GETTING_STARTED.markdown file explains all available gradle.properties settings along with their default values. To customize a setting, you can copy it into your gradle.properties file and assign your preferred value.

Clarity wants to standardize their strategy for local bundle configurations. This lesson covers these common properties:

  • liferay.workspace.product: Determine the Liferay product and version used by the workspace.
  • liferay.workspace.home.dir: Determine the location for downloading the Liferay bundle.
  • liferay.workspace.bundle.url: Determine the download sources for bundles.
  • liferay.workspace.bundle.cache.dir: Determine the location for storing downloaded bundle Zip files.

Configuring the Local Bundle Liferay Version

Even after workspace creation, you can specify the version of Liferay DXP or Liferay Portal used for your Liferay workspace. The liferay.workspace.product property determines the workspace’s product and version, as explained in the workspace’s GETTING_STARTED.markdown file:

#### liferay.workspace.product
Set the `liferay.workspace.product` to set the `app.server.tomcat.version`,
`liferay.workspace.bundle.url`, `liferay.workspace.docker.image.liferay`, and
`liferay.workspace.target.platform.version` that matches your Liferay Product
Version. To override each of these settings, set them individually.

As the Clarity team keeps pace with Liferay’s release schedule, they are regularly changing this value as new releases are distributed so they can test their solution against the latest versions.

By default, this property’s value sets the app.server.tomcat.version, liferay.workspace.bundle.url, liferay.workspace.docker.image.liferay, and liferay.workspace.target.platform.version properties. However, you can set alternative values for each property in the gradle.properties file.

Configuring the Local Bundle Installation Location

Liferay workspaces enable you deploy modules and extensions directly to the local Liferay bundle (the server) by configuring its location. The liferay.workspace.home.dir property manages the server location, as explained in the workspace’s GETTING_STARTED.markdown file:

#### liferay.workspace.home.dir
Set the folder that contains the Liferay bundle downloaded from the
`liferay.workspace.bundle.url` property. The default value is `bundles`.

Anticipating increased Liferay usage and the need for multiple workspaces, Clarity's team will retain the default liferay.workspace.home.dir value. This ensures a clear association between each workspace and its corresponding bundle.

The specified location is relative to the LIFERAY_WORKSPACE_HOME location. A location outside of the workspace can be used provided that the full and complete path is specified. 

Configuring the Bundle URL

Though less frequently customized, the liferay.workspace.bundle.url property determines the URL for downloading bundle archives. This URL can be remote (https://) or local (file://). By default, this property references the Liferay CDN for releases, as explained in the workspace’s GETTING_STARTED.markdown file:

#### liferay.workspace.bundle.url
Set this property to override the default setting provided by
`liferay.workspace.product`. Set the URL pointing to the bundle Zip to
download. If you did not set `liferay.workspace.product`, the default value is
`https://releases-cdn.liferay.com/portal/7.3.6-ga7/liferay-ce-portal-tomcat-7.3.6-ga7-20210301155526191.tar.gz`.

Clarity's IT security policies restrict access to public CDNs from within their network. To comply with these policies, Clarity maintains an “internal releases CDN” and can use the liferay.workspace.bundle.url property to redirect bundle downloads to their internal CDN.

Configuring the Cache Location

The first time you execute blade server init for a Liferay version, the corresponding archive (specified by liferay.workspace.bundle.url) is downloaded and stored locally in a cache. This accelerates initialization for future servers using the same version. Cached archives are stored by default in the user’s home directory (e.g., /Users for macOS; C:\Users for Windows; /home/username/[OS] for Linux). However, you can set an alternate cache location using the liferay.workspace.bundle.cache.dir property, as explained in the workspace’s GETTING_STARTED.markdown file:

#### liferay.workspace.bundle.cache.dir
Set the directory where the downloaded bundle Zip files are stored. The default
value is the `.liferay/bundles` folder inside the user home directory. The
default value is `~/.liferay/bundles`.

The Clarity development team regularly evaluates Liferay’s releases in order to take advantage of new features and test beta capabilities. However, each bundle is proximately 2GB in size. To manage their local bundle cache, they've configured the liferay.workspace.bundle.cache.dir property to store cached bundles in a location that is automatically cleaned at scheduled intervals. This proactive approach ensures efficient disk space utilization while enabling the team to stay up-to-date with the latest Liferay releases.

Conclusion

Great! You’ve explored configuring a local bundle by specifying its installation directory, Liferay version, and download locations. Next, you’ll learn about initializing and managing a local Liferay bundle within your configured workspace.

Loading Knowledge

Capabilities

Product

Education

Contact Us

Connect

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