Liferay Workspace helps you target a specific release of Liferay DXP, so dependencies get resolved properly. This makes upgrades easy: specify your target platform, and Workspace points to the new version. All your dependencies are updated to the latest ones provided in the targeted release.
Next, you’ll discover how all of this is possible.
Dependency Management with BOMs
You can target a version by importing a predefined bill of materials (BOM). This
only requires that you specify a property in your workspace’s
gradle.properties
file (see
this article
for details).
Each Liferay DXP version has a predefined BOM that you can specify for your workspace to reference. Each BOM defines the artifacts and their versions used in the specific release. BOMs list all dependencies in a management fashion, so it doesn’t add dependencies to your project; it only provides your build tool (e.g., Gradle or Maven) the versions needed for the project’s defined artifacts. This means you don’t need to specify your dependency versions; the BOM automatically defines the appropriate artifact versions based on the BOM.
You can override a BOM’s defined artifact version by specifying a different
version in your project’s build.gradle
. Artifact versions defined in your
project’s build files override those specified in the predefined BOM. Note that
overriding the BOM can be dangerous; make sure the new version is compatible in
the targeted platform.
For more information on BOMs, see the Importing Dependencies section in Maven’s official documentation. To view a BOM file and its mapping of artifacts and versions, visit repository.liferay.com and search for the BOM artifacts (e.g., release.portal.bom and release.dxp.bom).
Pretty cool, right? Next, you’ll learn how to leverage platform targeting in Dev Studio.
Leveraging Target Platform in Dev Studio
Liferay Dev Studio 3.2+ helps you streamline targeting a specific version even more. Dev Studio can index the configured Liferay DXP source code to
- provide advanced Java search (Open Type and Reference Searching) (article)
- debug Liferay DXP sources (article)
To enable this functionality, set the following property in your workspace’s
gradle.properties
file:
target.platform.index.sources=true
These options in Dev Studio are only available when developing in a Liferay Workspace, or if you have the Target Platform Gradle plugin applied to your multi-module Gradle project with specific configurations. See the Targeting a Platform Outside of Workspace article for more info on applying the Target Platform Gradle plugin.
Continue on to learn how to set the target platform.