AEM in 40 Days
CalendarPhase 2 · Environment & Project Anatomy

Day 9 of 40

The AEM Project Archetype

Generating a project and what every archetype property means

~40 min read2 videos2 source pages

By the end of today you should be able to

  1. Generate a new AEM project from the archetype and explain each required property
  2. Say what appId, appTitle and groupId actually control in the generated output
  3. Choose sensibly between the frontend module options and the includeExamples flag
  4. Explain why you should regenerate rather than hand-build an AEM project

What the archetype is for

A working AEM project is not one Maven module — it is eight or nine, with a specific set of interdependencies, package filters, embed rules and plugin configuration that must all agree. Getting that right by hand is a genuinely hard afternoon. The AEM Project Archetype is Adobe's maintained template that generates the whole thing correctly, following current best practice for the release you target.

It lives at github.com/adobe/aem-project-archetype and is versioned independently of AEM. Newer archetype versions track newer Core Components, newer build tooling and current Cloud Service conventions.

Generating a project

mvn -B org.apache.maven.plugins:maven-archetype-plugin:3.2.1:generate \
 -D archetypeGroupId=com.adobe.aem \
 -D archetypeArtifactId=aem-project-archetype \
 -D archetypeVersion=XX \
 -D appTitle="WKND Sites Project" \
 -D appId="wknd" \
 -D groupId="com.adobe.aem.guides"

Three properties do most of the work, and each one is hard to change afterwards:

  • appId — the short technical name. It becomes the folder under /apps and /conf, the clientlib category prefix, the Java package suffix and the artifact IDs. Lowercase, no spaces, no hyphens. This is the one that appears everywhere.
  • appTitle — the human-readable name shown in the AEM UI and package manager.
  • groupId — the Maven group ID and the base Java package.
Choose appId carefully

It is baked into paths, package names, clientlib categories and content structure. Renaming it later means touching hundreds of files and migrating repository paths. Spend the extra minute now.

The properties worth thinking about

  • aemVersioncloud for AEM as a Cloud Service, or a version like 6.5.17. This changes the generated dependencies and the whole project shape, so set it correctly.
  • frontendModulegeneral gives you a webpack-based ui.frontend; none omits it; there are also SPA options (react, angular) which pull in the SPA Editor, not what you want for a traditional site.
  • includeExamples — generates a "WKND Site Example" component library. Useful for learning, noise in a real project. Whatever you choose, day 10 covers removing the samples cleanly.
  • includeDispatcherConfig — you want this. It generates the dispatcher module.
  • language and country — seed the initial content structure, for example /content/wknd/us/en.
  • sdkVersion / includeErrorHandler / includeCommerce — situational; leave at defaults unless you know you need them.

First build

cd wknd
mvn clean install -PautoInstallPackage

That compiles the Java, runs unit tests, builds the content packages, assembles the all package and installs it to author on 4502. When it finishes, /apps/wknd exists in the repository and you can create a page from the generated templates.

If the build fails on first run it is nearly always one of: wrong Java version, Maven cannot reach Adobe's public repository, or AEM is not actually running on 4502. Check those three before anything else.

Keeping up with the archetype

The archetype generates a starting point, not a dependency — you own the output from that moment on. But Adobe keeps improving it, so it is worth periodically generating a fresh project with the latest archetype and diffing the build configuration against yours. New plugin versions, new package filters and new Core Components versions surface that way.

Today's takeaway

Never hand-assemble an AEM project. Generate it, choose appId carefully, set aemVersion=cloud, and diff against a fresh generation occasionally to pick up improvements.

Watch

Adobe's own videos for this topic. They load only when you press play.

Create Project using Archetype
AEM Project Archetype

Read on Experience League

The primary sources these notes are drawn from.

Your notes

Saved automatically to this browser.

Check yourself

10 questions on today's material. 80% to pass.

Take the quiz