How adobe/aem-project-archetype works
Purpose and Entry Point
This repository packages the AEM Project Archetype, a Maven archetype that generates configurable, multi-module Adobe Experience Manager projects rather than running an application itself. Generation begins through Maven Archetype Plugin metadata and is parameterized by properties such as AEM version, frontend type, Commerce, Forms, and Dispatcher inclusion.
• pom.xml
• src/main/resources/META-INF/maven/archetype-metadata.xml
• src/main/archetype/archetype.properties
Archetype Assembly and Lifecycle
The archetype’s source project is a template tree under src/main/archetype; Maven packages it as an archetype. Groovy hooks execute around packaging/generation to conditionally include modules, normalize generated files, and apply options. The generated root reactor then builds and deploys its selected AEM packages and frontend artifacts.
• src/main/archetype/pom.xml
• src/main/resources/META-INF/archetype-pre-package.groovy
• src/main/resources/META-INF/archetype-post-generate.groovy
Generated AEM Backend
The core module is the generated Java/OSGi bundle. It supplies example Sling-facing extension points—models, servlets, request filters, resource listeners, and scheduled jobs—which establish where project-specific server behavior belongs. AEM/Sling invokes these components; they operate against AEM’s JCR-backed content repository and HTTP request pipeline.
• src/main/archetype/core/pom.xml
• src/main/archetype/core/src/main/java/core/models/HelloWorldModel.java
• src/main/archetype/core/src/main/java/core/servlets/SimpleServlet.java
AEM Content Packages and Authoring Boundary
The generated project separates deployable application definitions, OSGi configuration, and mutable site content. ui.apps installs /apps components, HTL rendering scripts, client library declarations, and optional Commerce/Forms component overlays. ui.config supplies runmode-specific OSGi settings. ui.content seeds /conf, /content, DAM assets, editable templates, policies, language masters, and experience fragments—author-managed data after installation.
• src/main/archetype/ui.apps/src/main/content/jcr_root/apps/__appId__/components/page/body.html
• src/main/archetype/ui.config/src/main/content/jcr_root/apps/__appId__/osgiconfig/config
• src/main/archetype/ui.content/src/main/content/jcr_root/conf/__appId__/settings/wcm/templates
Frontend Delivery Variants
The archetype can generate conventional Webpack-built client libraries, React or Angular SPA Editor applications, a decoupled frontend, and React Adaptive Forms. Conventional assets compile to AEM clientlibs consumed by server-rendered pages. SPA variants use AEM model clients and component mappings to render AEM-authored content in browser applications; optional SSR adds Node/Express or Adobe I/O-style server entry points.
• src/main/archetype/ui.frontend.general/src/main/webpack/site/main.ts
• src/main/archetype/ui.frontend.react/src/index.js
• src/main/archetype/ui.frontend.angular/src/main.ts
Edge, Integrations, and Deployment
Dispatcher templates provide the Apache HTTPD/AEM Dispatcher boundary: virtual hosts and rewrites receive traffic; Dispatcher farms apply request filters, select AEM author/publish renders, and enforce cache/invalidation policy. Cloud and AMS/on-premise layouts are distinct. Optional CIF configuration connects Commerce components to a GraphQL endpoint; Forms content includes Salesforce and Microsoft Dynamics 365 cloud-configuration/data-model scaffolding.
• src/main/archetype/dispatcher.cloud/src/conf.dispatcher.d/available_farms/default.farm
• src/main/archetype/dispatcher.ams/src/conf.d/available_vhosts/__appId___publish.vhost
• src/main/archetype/ui.config/src/main/content/jcr_root/apps/__appId__/osgiconfig/config/com.adobe.cq.commerce.graphql.client.impl.GraphqlClientImpl~default.cfg.json
Aggregate Delivery
The generated all package is the primary installable aggregate, assembling selected OSGi bundles and content packages for AEM. Optional integration and UI-test modules exercise deployed AEM endpoints and browser flows; repository CI runs Maven validation, release/deploy, and Dispatcher SDK updates.
• src/main/archetype/all/pom.xml
• src/main/archetype/it.tests/src/main/java/it/tests/CreatePageIT.java
• .github/workflows/maven-test.yml
Main entry points: all/pom.xml All aggregate package · archetype/pom.xml Template reactor · core/pom.xml Core OSGi bundle · pom.xml Archetype Maven build
Components 19
Archetype build
Maven metadata, templates, and generation hooks.
- Archetype Maven build · Packages the template tree as a Maven archetype.
pom.xml - Archetype metadata · Defines generated files and required properties.
src/main/resources/META-INF/maven/archetype-metadata.xml - Generation properties · Selects AEM version, frontend, and optional features.
src/main/archetype/archetype.properties - Template reactor · Root Maven project copied into each generated project.
src/main/archetype/pom.xml - Pre-package hook · Conditionally assembles the archetype before packaging.
src/main/resources/META-INF/archetype-pre-package.groovy - Post-generate hook · Normalizes generated files and applies options.
src/main/resources/META-INF/archetype-post-generate.groovy
Generated AEM project
Selected modules emitted by the archetype.
- All aggregate package · Primary installable aggregate of selected packages and bundles.
src/main/archetype/all/pom.xml - Core OSGi bundle · Project server extension points for AEM and Sling.
src/main/archetype/core/pom.xml - Sling model example · Example request/content-backed component model.
src/main/archetype/core/src/main/java/core/models/HelloWorldModel.java - Sling servlet example · Example HTTP endpoint extension point.
src/main/archetype/core/src/main/java/core/servlets/SimpleServlet.java - Application package · Installs /apps components, HTL, and client library definitions.
src/main/archetype/ui.apps/src/main/content/jcr_root/apps/__appId__/components/page/body.html - OSGi configuration · Provides runmode-specific settings under /apps.
src/main/archetype/ui.config/src/main/content/jcr_root/apps/__appId__/osgiconfig/config - Seeded site content · Installs templates, policies, and initial authorable content.
src/main/archetype/ui.content/src/main/content/jcr_root/conf/__appId__/settings/wcm/templates - AEM runtime · Hosts OSGi services, rendering, and JCR-backed content.
- Frontend variants · Generates clientlibs or React/Angular browser applications.
src/main/archetype/ui.frontend.general/src/main/webpack/site/main.ts
Delivery and integrations
Optional edge, external-service, and validation paths.
- Dispatcher edge · Filters, routes, and caches requests before AEM.
src/main/archetype/dispatcher.cloud/src/conf.dispatcher.d/available_farms/default.farm - Commerce GraphQL config · Connects CIF components to a GraphQL endpoint.
src/main/archetype/ui.config/src/main/content/jcr_root/apps/__appId__/osgiconfig/config/com.adobe.cq.commerce.graphql.client.impl.GraphqlClientImpl~default.cfg.json - Deployed integration tests · Exercises generated AEM endpoints and flows.
src/main/archetype/it.tests/src/main/java/it/tests/CreatePageIT.java - Repository CI · Runs Maven validation and delivery checks.
.github/workflows/maven-test.yml
Connections 23
- Archetype Maven build → Archetype metadata: reads
- Archetype Maven build → Pre-package hook: runs
- Archetype metadata → Generation properties: parameterizes
- Generation properties → Template reactor: selects modules
- Pre-package hook → Template reactor: assembles
- Template reactor → Post-generate hook: generates then runs
- Template reactor → All aggregate package: includes
- All aggregate package → Core OSGi bundle: assembles
- All aggregate package → Application package: assembles
- All aggregate package → OSGi configuration: assembles
- All aggregate package → Seeded site content: assembles
- All aggregate package → AEM runtime: installs to
- Core OSGi bundle → Sling model example: contains
- Core OSGi bundle → Sling servlet example: contains
- AEM runtime → Core OSGi bundle: invokes
- AEM runtime → Application package: renders components from
- AEM runtime → Seeded site content: serves and authors
- Frontend variants → Application package: delivers clientlibs to
- Dispatcher edge → AEM runtime: filters and routes to
- OSGi configuration → Commerce GraphQL config: optionally configures
- Deployed integration tests → AEM runtime: tests deployed
- Repository CI → Archetype Maven build: validates
- Repository CI → Deployed integration tests: runs