This feature is available with Liferay Workspace version 11.0.0+
This feature is only meant for local development when deploying to a local bundle. It is not intended for building client extensions that will be uploaded to a Liferay SaaS instance via lcp deploy
A client extension LUFFA built with the liferay.virtual.instance.id property set will have virtual instance specific information encoded within it as well as the virtual instance appended to the filename which may result in unexpected behavior when published to a Liferay SaaS instance. When building a client extension intended for Liferay SaaS, perform the build without the property set.
The Client Extensions framework already supports deploying to specific virtual instances by setting the dxp.lxc.liferay.com.virtualInstanceId property in the client-extension.yaml as mentioned in our documentation. However, there is a limitation with that method where deploying the same client extension to multiple virtual instances is not possible. If a client extension is deployed to one instance, in order to deploy it to a different instance, it must first be undeployed from the original instance.
A new liferay.virtual.instance.id Gradle property was added to address this limitation by enabling simultaneous deployments to multiple instances. The dxp.lxc.liferay.com.virtualInstanceId property will continue to function as before, but specifying the liferay.virtual.instance.id property will take precedence if both properties are set.
Deploying a client extension to the default Portal instance
By default, running ./gradlew deploy will still deploy a client extension to the default Portal instance so no additional steps are required.
Deploying a client extension to a non-default virtual instance
You can do this by using the liferay.virtual.instance.id Gradle property when deploying the client extension. There are three methods of doing this:
-
Within
gradle.properties, set the following (replacing “my.web.id” with the Web ID of the virtual instance):
liferay.virtual.instance.id=my.web.id
-
Within
settings.gradle, add the following to theliferayWorkspaceextension:
gradle.liferayWorkspace {
virtualInstanceId = "my.web.id"
}
-
Pass in the following parameter when running the
deploytask in the command line:
./gradlew deploy -Pliferay.virtual.instance.id=my.web.id
Deploying the same client extension to multiple virtual instances
After deploying a client extension to the default Portal instance or non-default virtual instance using any of the methods above, simply use one of the deployment methods again replacing my.web.id with the Web ID of the subsequent virtual instance. Repeat as needed.