If you prefer to not use Liferay Workspace, but still want to target a platform,
you must apply the
Target Platform Gradle plugin
to the root build.gradle
file of your custom multi-module Gradle build.
To do this, follow the steps below.
-
Open your project’s
build.gradle
file and add this:buildscript { dependencies { classpath group: "com.liferay", name: "com.liferay.gradle.plugins.target.platform", version: "2.0.0" } repositories { maven { url "https://repository-cdn.liferay.com/nexus/content/groups/public" } } }
This sets the dependency on the Target Platform Gradle plugin and configures the repository that provides the necessary artifacts for your project build.
-
Apply Liferay’s Target Platform Gradle plugin to the
build.xml
file:apply plugin: "com.liferay.target.platform"
-
Set the Target Platform plugin’s dependencies:
dependencies { targetPlatformBoms group: "com.liferay.portal", name: "release.portal.bom", version: "7.2.0" targetPlatformBoms group: "com.liferay.portal", name: "release.portal.bom.compile.only", version: "7.2.0" targetPlatformBoms group: "com.liferay.portal", name: "release.portal.bom.third.party", version: "7.2.0" }
These dependencies are described below:
com.liferay.ce.portal.bom
: provides all the artifacts included in Liferay DXP.com.liferay.ce.portal.compile.only
: provides artifacts that are not included in Liferay DXP, but are necessary to reference during the build (e.g.,org.osgi.core
).release.portal.bom.third.party
: provides all third party artifacts that make up the Liferay Portal bundle.Liferay DXP users must replace the artifact names and versions:
release.portal.bom
→release.dxp.bom
release.portal.bom.compile.only
→release.dxp.bom.compile.only
release.portal.bom.third.party
→release.dxp.bom.third.party
7.2.0
→7.2.10
-
If you’re interested in advanced search and/or debugging Liferay DXP’s source using Liferay Dev Studio, you must also apply the following configuration:
targetPlatformIDE { includeGroups "com.liferay", "com.liferay.portal" }
This indexes the target platform’s source code and makes it available to Dev Studio.
Now you can define your target platform!