Maven Archetype for AEM usage
Basic usage
Generate a new AEM project using interactive mode by executing:
mvn org.apache.maven.plugins:maven-archetype-plugin:3.3.1:generate \
-DarchetypeGroupId=io.wcm.maven.archetypes \
-DarchetypeArtifactId=io.wcm.maven.archetypes.aem \
-DarchetypeVersion=3.9.2
As minimal input parameters you have to enter a value for groupId
and projectName
- all other parameters can be derived from these or have sensible default parameters. But in most cases you want to specify more parameters, see next chapters for all available parameters and some examples.
Archetype parameters
Parameter | Default | Description |
---|---|---|
projectName | Project name is used for building AEM apps path, content path, CONGA role names etc. | |
groupId | Maven artifact groupId for all projects | |
artifactId | *) | Maven artifact “root” artifactId, is suffixed for the individual modules |
version | *) | Maven artifact version - e.g. 1.0.0-SNAPSHOT |
package | *) | Java class package name |
packageGroupName | *) | Group name for AEM content package |
aemAuthorPort | 4502 | Default port for local AEM author instance |
aemPublishPort | 4503 | Default port for local AEM publish instance |
optionJavaVersion | 11 | Java version (11) |
optionAemVersion | cloud | AEM major version (6.5 or cloud ) |
optionAemServicePack | n | Use latest service pack for AEM 6.5. You need to deploy artifacts following these conventions |
optionAemServicePackAPI | n | Use AEM API from latest service pack for AEM 6.5. This is implicitly activated if optionAemServicePack = y. |
optionSlingInitialContentBundle | y | y: AEM application projects is set up with scripts and content parts as JSON files within the OSGi bundle with Sling-Initial Content, suitable for File System Resource Provider. Works with all AEM versions. n: Projects are set up with FileVault package layout, suitable for AEM Developer Tools for Eclipse (Sling IDE). |
optionEditableTemplates | y | Set up projects using editable templates. |
optionMultiBundleLayout | n | Split up AEM application in multiple bundles for modularizing large AM applications. Requires optionSlingInitialContentBundle=‘y’. |
optionContextAwareConfig | y | Setup project with Sling Context-Aware Configuration and wcm.io Context-Aware Configuration extensions. |
optionFrontend | n | Setup frontend build project with webpack |
optionNodeJsPlugin | n | Use wcm.io Node JS plugin for frontend build (recommended when Maven NodeJS Proxy is used). If not enabled the frontend-maven-plugin is used instead. For AEMaaCS it is recommended to stick with frontend-maven-plugin. |
optionWcmioHandler | n | Setup project using wcm.io AEM libraries, especially the wcm.io Handler Infrastructure and wcm.io WCM Core Components. Requires optionContextAwareConfig=‘y’. |
optionWcmioConga | y | Setup project using CONGA. Mandatory for 6.5 projects, optional (but default) for cloud projects. |
optionSlingModelsLatest | n | Use latest Sling Models bundles (ignored for AEMaaCS) |
optionContextAwareConfigLatest | n | Use latest Context-Aware Configuration bundles (ignored for AEMaaCS) |
optionAcsCommons | n | Deploy ACS AEM Commons. |
optionIntegrationTests | n | Generate an integration tests project based on AEM testing clients. |
*) Sensible default
Usage examples
Minimal AEM project with FileVault package layout and Java 11 for AEMaaCS
mvn org.apache.maven.plugins:maven-archetype-plugin:3.3.1:generate -DinteractiveMode=false \
-DarchetypeGroupId=io.wcm.maven.archetypes \
-DarchetypeArtifactId=io.wcm.maven.archetypes.aem \
-DarchetypeVersion=3.9.2 \
-DprojectName=myproject1 \
-DgroupId=mycompany.myprojectgroup \
-DartifactId=mycompany.myprojectgroup.myproject1 \
-Dversion=1.0.0-SNAPSHOT \
-Dpackage=mycompany.myprojectgroup.myproject1 \
-DpackageGroupName=mycompany \
-DaemAuthorPort=4502 \
-DaemPublishPort=4503 \
-DoptionJavaVersion=11 \
-DoptionAemVersion=cloud \
-DoptionAemServicePack=n \
-DoptionAemServicePackAPI=n \
-DoptionSlingInitialContentBundle=n \
-DoptionEditableTemplates=y \
-DoptionMultiBundleLayout=n \
-DoptionContextAwareConfig=y \
-DoptionWcmioHandler=n \
-DoptionSlingModelsLatest=n \
-DoptionContextAwareConfigLatest=n \
-DoptionAcsCommons=n \
-DoptionFrontend=n \
-DoptionNodeJsPlugin=n \
-DoptionIntegrationTests=n
AEM project with wcm.io and Sling-Initial-Content project layout and Java 11 for AEM 6.5
mvn org.apache.maven.plugins:maven-archetype-plugin:3.3.1:generate -DinteractiveMode=false \
-DarchetypeGroupId=io.wcm.maven.archetypes \
-DarchetypeArtifactId=io.wcm.maven.archetypes.aem \
-DarchetypeVersion=3.9.2 \
-DprojectName=myproject2 \
-DgroupId=mycompany.myprojectgroup \
-DartifactId=mycompany.myprojectgroup.myproject2 \
-Dversion=1.0.0-SNAPSHOT \
-Dpackage=mycompany.myprojectgroup.myproject2 \
-DpackageGroupName=mycompany \
-DaemAuthorPort=4502 \
-DaemPublishPort=4503 \
-DoptionJavaVersion=11 \
-DoptionAemVersion=6.5 \
-DoptionAemServicePack=n \
-DoptionAemServicePackAPI=n \
-DoptionSlingInitialContentBundle=y \
-DoptionEditableTemplates=y \
-DoptionMultiBundleLayout=n \
-DoptionContextAwareConfig=y \
-DoptionWcmioHandler=y \
-DoptionSlingModelsLatest=n \
-DoptionContextAwareConfigLatest=n \
-DoptionAcsCommons=n \
-DoptionFrontend=y \
-DoptionNodeJsPlugin=n \
-DoptionIntegrationTests=n
Requirements
- Java 11
- Apache Maven 3.3.9 or higher
- AEM 6.5 or AEMaaCS
- Optional: If you want to install latest service packs you have to upload them manually to your Maven Artifact Manager following these conventions for naming them.