AEM as Cloud Service Project Structure – 2

 


This article is continuation of Project Structure – 1, it details mainly about POM changes for Cloud Service compatible project.

We already know /apps & /libs are considered immutable areas which cannot be changed at runtime & rest are all considered as mutable areas which can be changed at runtime.

Package Types

In AEM as Cloud Service,

  • Packages are marked with declared “packageType” for identification during deployment time. They are as below.
SI No. Package Type (packageType) Description
1. container Acts as container. Must not directly contain OSGI bundles or configs.
2. application Code (Immutable) packages.
3. Content Content (Mutable) packages.

 

  • As container package “all” is the singular deployment artifact that contains all the code & content packages, there must be an attribute which identifies only this package to be deployed. To ensure this, in “FileVault Content Package Maven Plug-In” below configuration needs to be set for those packages which are not targeted for deployment e.g. apps, ui.config, ui.content etc. as these are not target for deployment. This configuration property should not be set in “all” package.

 

<properties><cloudManagerTarget>none</cloudManageTarget></properties>

NOTE: – There are two ways to ensure this configuration is set properly or not which is very important to make sure deployment artifacts are identified successfully.

  • Post compilation of modules verify below mentioned entry is present in <module>/target/vault-work/META-INF/vault/properties.xml

<entry key=”cloudManagerTarget”>none</entry>

  • Download “Build & Unit Testing” logs post completion of the step from Cloud Manager & at the end of the logs look for “The following artifacts considered were discovered:” which has two categories
    • content-package – Cloud Target which should be “all”
    • skipped-content-package – Non-Cloud Targets.

Code Package & OSGI Bundles

  • Application package contains all the application code.
  • It’s packageType is “application”.
  • It is not targeted for cloud manager deployment & hence cloudManagerTarget should be set to “none”.
SI No. Module Scope Purpose
1. core /src/main/java/<project> Bundle Jar
2. ui.apps /apps/<project>/components Components
/apps/<project>/pages Page Components
/apps/<project>/templates Templates
/apps/<project>/clientlibs JS/CSS ClientLibs
/apps/cq, /apps/dam etc. Overlays
/apps/settings Context Aware Configs
/apps/rep:policy ACLs
oak:index Oak Index Configs
3. ui.config /apps/<project>/osgiconfig/<runmode> Run Modes

Content Packages

  • Content package contains all the content & configurations.
  • It’s packageType is “content”.
  • It is not targeted for cloud manager deployment & hence cloudManagerTarget should be set to “none”.
SI No. Module Scope Purpose
1. ui.content /conf Context Aware Configs
/content Required Content Structures
/content/dam Required DAM Assets
/content/cq:tags Tagging Taxonomy
/etc Legacy etc nodes

Container Packages

  • Container package contains ONLY includes deployable artifacts, the OSGI bundle Jar file & packages such as ui.apps, ui.config, ui.content as embeds.
  • The “all” package must not have any content or code of its own.
  • Packages are included using FileVault Content Package Maven Plug-In Embed Configs
  • It’s packageType is “container”.
  • It is cloud manager target & hence cloudManagerTarget need not be set.
  • To target AEM Author, Publish or Both, the packages are embedded in “all” container package in a special folder, in the below format.

/apps/<app-name>-packages/(content|application|container)/install(.author|.publish)?

 Where,

  • /apps – 1st Level must be application folder.
  • /<app-name>-packages – 2nd Level typically project name followed by -packages. There can be third party folders as well e.g. either /apps/my-project-packages or /apps/vendor-packages.
  • /packageType – 3rd Level is package type which can be
    • content – Content packages are grouped here.
    • application – Application packages are grouped here.
    • container – Container packages. Usually 3rd party vendor packages are grouped here.
  • /install – 4th Level can be used to target specific environments or generally deploy to all environments.
    • /install.author – Install the packages to all author environments.
    • /install.publish – Install the packages to all publish environments.
    • /install – Install the packages on both environments.
  • As code & content packages are embedded in the “all” container package, the embedded target paths must be added to the “filter.xml” Example as below.

<filter root=”/apps/<app-name>-packages”/>

 Container package can be represented as below.

AEM as Cloud Service Container Package (Courtesy: Adobe)

Repository Structure Package

  • As explained in the previous article, Repository Structure Package is a simple module which only contains a POM file but is a must as application package roots are defined here. As this is required for code packages, it’s packageType is “application”.
  • Code packages require configuring “FileVault Content Package Maven Plug-In” configuration to reference a <repositoryStructurePackage> that enforces the correctness of structural dependencies.

POM XML Snippet

Code/Content Package

<configuration>

<group>${project.groupId}</group>

<name>project.ui.apps or project.ui.config or project.ui.content</name>

<packageType>application or content</packageType>

<accessControlHandling>merge</accessControlHandling>

<properties>

<cloudManagerTarget>none</cloudManagerTarget>

</properties>

</configuration>

 

Repository Project Structure

Filter Definitions

<configuration>

<properties>

<cloudManagerTarget>none</cloudManagerTarget>

</properties>

<filters>

<filter><root>/apps/<project-root></root></filter>

…….

</filters>

</configuration>

 

Referencing Repository Structure

<configuration>

        <!– Understanding Purpose, please go through link provide in reference section for details –>

<repositoryStructurePackages>

<repositoryStructurePackage>

<groupId>${project.groupId}</groupId>

<artifactId>ui.apps.structure</artifactId>

<version>${project.version}</version>

</repositoryStructurePackage>

</repositoryStructurePackages>

</configuration>

 

Container Package

<configuration>

                <!– Understanding Purpose, please go through link provide in reference section for details –>

<embeddeds>

<embedded>

<groupId>${project.groupId}</groupId>

<artifactId>my-app.core or my-app.ui.apps or my-app.ui.config</artifactId>

<type>jar/zip</type>

<target>/apps/my-app-packages/application/install</target>

</embedded>

<embedded>

<groupId>${project.groupId}</groupId>

<artifactId>my-app.ui.content</artifactId>

<type>zip</type>

<target>/apps/my-app-packages/content/install</target>

</embedded>

<embeddeds>

</configuration>

References

 

Comments

Popular posts from this blog

AEM as a Cloud Service - Benefits and Limitations

AEM as Cloud Service Migration Tools