Deploying your modules only to be met with console errors or mysterious problems can be frustrating. You can avoid this painful process by resolving your modules before deployment. This can be done by calling the
resolve Gradle task provided by Liferay Workspace.
This task gathers all the capabilities provided by
- the specified version of Liferay Portal (i.e., targeted platform)
- the current workspace’s modules
Some capabilities/information gathered by the
resolve task that are validated include
- declared required capabilities
- module versions
- package imports/use constraints
- service references
It also computes a list of run requirements for your project. Then it compares the current project’s requirements against the gathered capabilities. If your project requires something not available in the gathered list of capabilities, the task fails.
The task can only validate OSGi modules. It does not work with WAR-style projects, themes, or npm portlets.
resolve task can automatically gather the available capabilities from your workspace, but you must specify this for your targeted Liferay Portal version. To do this, open your workspace’s
gradle.properties file and set the
liferay.workspace.target.platform.version property to the version you want to target. For example,
If you’re using Liferay DXP, the versions are specified based on service packs. For example, you could set your target platform workspace Gradle property to
Important: You can leverage the target platform features in Liferay Portal GA6+ and Liferay DXP SP7+. Previous versions do not provide these features.
The versions following the SP7 release of DXP follow fix pack versions (e.g.,
This provides a static distro JAR for the specified version of Liferay Portal, which contains all the metadata (i.e., capabilities, packages, versions, etc.) running in that version. The distro JAR is a complete snapshot of everything provided in the OSGi runtime; this serves as the target platform’s list of capabilities that your modules are validated against.
You can now validate your module projects before deploying them! Sometimes, you must modify the
resolve task’s default behavior to successfully validate your app. See the Modifying the Target Platform’s Capabilities tutorial for more information. For help resolving common output errors printed by the
resolve task, see the Resolving Common Output Errors Reported by the resolve Task article.