Deploying custom Oak index definitions across AEM as a Cloud Service environments
This article explains how to deploy custom Oak index definitions successfully across Cloud Manager, local SDK, and Rapid Development Environments (RDE) in Adobe Experience Manager as a Cloud Service by using environment-specific wrapper configurations.
Description description
Environment
Adobe Experience Manager as a Cloud Service (AEMaaCS) (all versions)
Symptoms
- Custom Oak index definitions deploy successfully to Cloud environments using Cloud Manager pipelines.
- The same index definitions don’t result in the custom index being created or available when deployed to local AEM SDK or RDE environments.
- Placing index definitions as oak:index nodes in code (under ui.apps) causes Cloud Manager builds to fail.
- Only one canonical
diff.jsonindex definition is maintained in source control.
Cause
Cloud Manager and local/RDE environments require different wrapper node types for Oak index definitions. Using the same wrapper for all environments leads to deployment failures in some environments.
Resolution resolution
Follow the steps below to resolve the issue:
-
Maintain a single canonical
diff.jsonindex definition in your source control at:ui.apps/src/main/content/jcr_root/_oak_index/diff.index/diff.json -
Create two environment-specific wrapper
.content.xmlfiles:-
For Cloud Manager (Pipeline Mode):
-
src/main/sim-wrapper/pipeline/.content.xml
Example content:
<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0" jcr:primaryType="nt:unstructured" type="lucene" includedPaths="/same" queryPaths="/same" async="async"> <diff.json jcr:primaryType="nt:file"/> </jcr:root>- For Local SDK and RDE:
src/main/sim-wrapper/local/.content.xml
Example content:
<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0" jcr:primaryType="oak:QueryIndexDefinition" type="disabled"> <diff.json jcr:primaryType="nt:file"/> </jcr:root> -
-
Configure Maven profiles in your
ui.apps/pom.xmlto switch the wrapper at build time:-
Set the Pipeline Mode profile (For example: sim-pipeline) as active by default for Cloud Manager builds.
-
Use a separate profile (For example: sim-local) for local SDK and RDE builds.
-
-
Build and deploy using the correct Maven profile for each environment:
-
For Cloud Manager: Run the standard build (For example:
mvn clean package) or with the pipeline profile, if needed. -
For Local SDK: Run
mvn clean install -Psim-local,autoInstallSinglePackage -
For RDE: Run
mvn clean package -Psim-localand deploy withaio aem:rde:install <built-zip>
-
-
Before deploying, validate that the generated ZIP package contains the correct
.content.xmlfor the target environment. -
For further details and examples, refer to the Oak Indexing Simplified Guide.