Tuesday, July 28, 2020

AEM Project Setup

This tutorial covers the creation of a Maven Multi Module Project to manage the code and configurations for an Adobe Experience Manager Site.

Prerequisites


  • Instance of Adobe Experience Manager available locally.
  • java 7+
  • maven
We will generate a new Adobe Experience Manager project using the AEM Project Archetype . Your AEM project contains all of the code, content, and configurations used for a Sites implementation.

What is a Maven project? Apache Maven is a software management tool to build projects. All Adobe Experience Manager implementations use Maven projects to build, manage and deploy custom code on top of AEM.
What is a Maven archetype? - A Maven archetype is a template or pattern for generating new projects. The AEM Project archetype allows us to generate a new project with a custom namespace and include a project structure that follows best practices, greatly accelerating our project.

Create the project


We use version 22 of the archetype. However, it is always a best practice to use the latest version of the archetype to generate a new project.

The next series of steps are:

Step 1: Open command prompt and check maven is installed correctly.

maven version

Step 2: Verify that the adobe-public profile is active by running the following command:

Success if adobe-public is active.
adobe-public

If you do not see the adobe-public it is an indication that the Adobe repo is not properly referenced in your ~/.m2/settings.xml file. Please revisit the steps to install and configure Apache Maven in a local development environment .

Step 3: Navigate to a directory in which you want to generate the AEM project.  and run below maven command.

mvn archetype:generate -B \
  -DarchetypeGroupId=com.adobe.granite.archetypes \
  -DarchetypeArtifactId=aem-project-archetype \
  -DarchetypeVersion=22 \
  -DgroupId=com.adobe.aem.guides \
  -Dversion=0.0.1-SNAPSHOT \
  -DappsFolderName=asc \
  -DartifactId=aem-guides-asc \
  -Dpackage=com.adobe.aem.guides.asc \
  -DartifactName="ASC Sites Project" \
  -DcomponentGroupName=ASC \
  -DconfFolderName=asc \
  -DcontentFolderName=asc \
  -DcssId=asc \
  -DisSingleCountryWebsite=n \
  -Dlanguage_country=en_us \
  -DoptionAemVersion=6.5.0 \
  -DoptionDispatcherConfig=none \
  -DoptionIncludeErrorHandler=n \
  -DoptionIncludeExamples=y \
  -DoptionIncludeFrontendModule=y \
  -DpackageGroup=asc \
  -DsiteName="ASC Site"

mvn-archetype-aem

It will scan and create project in specified directory.


Step 4: You can go the directory and can look below project structure.

project structure

For above used properties refer detail here  https://experienceleague.adobe.com/docs/experience-manager-core-components/using/developing/archetype/overview.html?lang=en


Build the project:
Step 1: Go to project: cd aem-guides-asc

Step 2: Run the following command to build and deploy the entire project to AEM:

   mvn clean install -PautoInstallPackage


Note: Please start AEM instance first before running AEM deploy command.
You can run below command to deploy code on AEM publish instance. You can refer parent pom.xml for the same and also README.md file which has all instructions to deploy code.


Step 3: Navigate to the Sites console: http://<host>:<port>/sites.html/content for e.g. if your instance is running on 4502 then open below url in browser and login with username/password. Default credentials would be admin/admin.



Open any page from project and if it working fine then we are done!

aem-page

Congratulations! Your project is set up now.



1 comment:

ElasticSearch vs Apache SolrCloud

  Elasticsearch and Apache SolrCloud are both powerful, distributed search engines built on top of Apache Lucene. Both Elasticsearch and S...