AEM Setup Part 2 : Code and Site Setup


You will need to have an installed AEM instance. If not see Part 1 -

Install Maven

Maven is a tool used to build java projects, it it also used to manage depenencies, if you want to build your source code you will first need to install maven on your machine.

First check if you have maven installed.

mvn -version

If you have maven installed you can skip this section.

Download maven  choose the latest binary zip archive, download, unzip and add to a folder on you machine, for example.

Next you will need to add maven to your path variable. First create a system variable called MAVEN_HOME with the value 'C:\Program Files\apache-maven-3.3.9'.

Add the value %MAVEN_HOME%\bin to the path variable

Open a new terminal (close existing terminals to pick up the new environment variable). The run the following command to confirm installation.

mvn - version

Choose an IDE

Next you need an IDE to edit the souce code. I prefer to use IntelliJ but you can also use eclipse or visual studio code - A free version of IntelliJ can be downloaded from the IntelliJ website.

Deploy AEM project.

You may already have an AEM project which you can clone but we will create a new project from the latest AEM archetype.

The AEM archetype provides a minimal best practice template for starting new AEM projects.  The best place to start is to find the git hub repository for the Archetype, this has the instructions on how to generate a new project. The archetype can be found here.

To start, create a new folder to store your project and open up a windows terminal with administrator privileges. Modify the below command for your project as per the instructions on the archetype git hub repository. The command I used is below.

mvn -B archetype:generate  -D archetypeGroupId=com.adobe.aem -D archetypeArtifactId=aem-project-archetype -D archetypeVersion=35 -D aemVersion=6.5.7 -D appTitle="AEM Shack" -D appId="aemshack" -D groupId="com.aemshack"

Once the command has completed  you can open the project in your IDE.

The readme file explains how to deploy your project to AEM. The command to build and deploy this project is. Make sure you have you local aem instance running.

mvn clean install -PautoInstallSinglePackage

Once complete login into AEM, you should see your site under the sites section.

To deploy to your publish instance you can use the below command.

mvn clean install -PautoInstallSinglePackagePublish

Next Steps

Install development tools see part 3.