Client extensions targeting multiple companies

The client extension modules allow for specifying a target company in a multi-instance portal using a deprecated property dxp.lxc.liferay.com.virtualInstanceId within client-extension.yaml. This property is deprecated and we’re supposed to use the liferay.virtual.instance.id gradle property to target companies (see Working with Client Extensions - Liferay Official Documentation - Liferay Learn ) ; however this doesn’t seem to keep in mind that there may be multiple client extensions targeting different and multiple companies.

The solution in the deprecated mechanism is quite elegant and simply having one client-extension.yaml with multiple definitions of the same client extension targeting multiple companies.

How is this supposed to be solved using gradle properties (which are supposed to be project wide config)? Has anyone solved this for their project?

Hey elindoorn, thanks for raising this concern. I can bring this up internally with the team and get back to you. Would you be able to provide more information on what type of client extensions you’re using?

Hi Tim_Pak,

We have about 10 portal instances, with different functionality on each. some (customElement) client extensions target only company A; an editorConfigContributor only targeting B, a combi of globalJS/globalCSS targetting 3 companies, some targeting basically all instances; themeCSS targeting company E, etc.

Hey elindoorn,

Thanks for sharing your use case with us. For now, we recommend using a custom script that maps each virtual instance to the client extension projects it should receive and loop through them to target deploy. This can be done via Gradle using the GradleBuild task type, or via a shell script to wrap each gradlew invocation.

We’ll look into a long term solution to cleanly handle targeting multiple virtual instances.