Wednesday, March 21, 2018

Creating standard AEM project structure on latest Archetype

Objective:

Archetypes create a minimal AEM project setup which works as a starting point for any new AEM application. So when setting up codebase for your new project, DO NOT COPY it from your old codebase. Instead, the code base should be setup using latest archetype. Using archetype is very easy thing and it just need to run a single command. Even if you are migrating old code bases to new AEM version, start from creating a new code base based on recommended archetype (Refer table below) and then copy individual pieces of old code base to appropriate location as per new archetype structure. 

This article talks about maven archetypes. If you are looking for Lazybones, refer this link: https://helpx.adobe.com/experience-manager/using/aem_lazybones.html


Solution:

Based on your AEM version, choose the desired project archetype from the below table:

Archetype VersionAEM Version
76.0 or newer
86.0 or newer
96.0 or newer
106.0 or newer
116.2 or newer
126.3 or newer
136.4, 6.3 + SP2
146.4, 6.3 + SP2
156.4, 6.3 + SP2
166.4, 6.3 + SP2
176.4, 6.3 + SP2
186.5, 6.4, 6.3 + SP3
196.5, 6.4, 6.3 + SP3
206.5, 6.4, 6.3 + SP3


Follow these steps to generate standard project structure:
  1. Go to the project code folder
  2. Open command prompt
  3. Run the below command:
    mvn org.apache.maven.plugins:maven-archetype-plugin:2.4:generate -DarchetypeGroupId=com.adobe.granite.archetypes -DarchetypeArtifactId=aem-project-archetype -DarchetypeVersion=18 -DarchetypeCatalog=https://repo.adobe.com/nexus/content/groups/public/
    OR
    mvn archetype:generate -DarchetypeGroupId=com.adobe.granite.archetypes -DarchetypeArtifactId=aem-project-archetype -DarchetypeVersion=20

    *Change the "DarchetypeVersion" parameter depending on AEM version. Refer table above.
  4. When prompt enter additional details about groupId, artifactId etc.


References:
1. https://helpx.adobe.com/experience-manager/using/maven_arch13.html
2. https://github.com/adobe/aem-project-archetype
3. https://github.com/adobe/aem-project-archetype/blob/master/VERSIONS.md

No comments:

Post a Comment

CDN | Clearing Cloudflare cache

In order to clear Cloudflare cache automatically via code, follow below steps: 1. Develop Custom TransportHandler Develop a custom Trans...