This document explains how you can use the AEM Project Archetype to create a minimal, best-practices-based Adobe Experience Manager project as a starting point for your own AEM projects.
It focuses on general usage patterns and what the archetype does for you. For detailed build options and technical instructions, please see the documentation in the GitHub repository of the archetype.
The latest AEM Project Archetype and associated technical documentation can be found on GitHub.
The project archetype makes it easy to get started developing on AEM. You can take your first steps with the archetype in a number of ways.
The first step using the archetype is to create a project, which generates the modules in a local file structure. As part of project generation, a number of properties for your project can be defined such as project name, version, enabling various options, etc.
Whenever you build the archetype, it will also generate a series of readmes, providing you with the technical details and usage of each module as linked below.
Building the project with Maven creates the artifacts (packages and OSGi bundles), that can be deployed to AEM. Additional Maven commands and profiles can be used to deploy the project artifacts to an AEM instance.
The archetype is made up of modules, all of which are created automatically when using the archetype.
/etc parts of the project, i.e. JS and CSS clientlibs, components, and templates.
The modules of the archetype represented in Maven are deployed to AEM as content packages representing the application, the content, and the necessary OSGi bundles.
pom.xml at the root of the project (
<src-directory>/<project>/pom.xml) is known as the parent POM and drives the structure of the project as well as manages dependencies and certain global properties of the project.
<properties> section of the parent POM defines several global properties that are important to the deployment of your project on an AEM instance such as user name/password, host name/port, etc.
These properties are set up to deploy to a local AEM instance, as this is the most common build that developers will do. Notice there are properties to deploy to an author instance as well as a publish instance. This is also where the credentials are set to authenticate with the AEM instance. The default
admin:admin credentials are used.
These properties are set up so that they can be overridden when deploying to higher level environments. In this way the POM files do not have to change, but variables like
sling.password can be overridden via command line arguments:
mvn -PautoInstallPackage clean install -Daem.host=production.hostname -Dsling.password=productionpasswd
<modules> section of the parent POM defines the modules that the project will build. By default the project builds the standard modules previously defined. More modules can always be added as a project evolves.
<dependencyManagement> section of the parent POM defines all of the dependencies and versions of APIs that are used in the project. Versions should be managed in the parent POM. Sub-modules should not include any version information.
One of the key dependencies is the AEM Java API Jar. This will include all of the AEM APIs with just a single dependency entry for the version of AEM.
As a best practice you should update the uber-jar version to match the target version of AEM. For example, if you plan to deploy to AEM 6.5 you should update the version of the uber-jar to 6.5.X, where
X is the latest service pack.
The archetype of course leverages the Core Components. Therefore, in order to leverage the Core Components in all deployments, it is a best practice to include them as part of the Maven project.
The core.wcm.components.examples are a set of sample pages that illustrate examples of the Core Components. As a best practice, when deploying a project for production use you should remove this dependency and subpackage inclusion.
The Core Components and the archetype are maintained as separate GitHub projects and as such their releases differ.
Each release of the archetype will utilize the latest release of the Core Components available at the time of the release. However, you may wish to update the dependency on the Core Components manually.
There are three levels of testing contained in the project and because they are different types of tests, they are executed in different ways or in different places.