How to create an AEM Project from the scratch with Maven

Adobe Experience Manager is one of the famous Content Management System.

AEM Logo

And our company mainly uses it for the CMS needs of our customers. Related to AEM, although you can find a lot of documents and content on the internet, I want to share my experience with how to create an AEM project. Almost all documents explain this action on Linux or Mac workstations. But in this article, I’ll try to explain how to do it on Windows!

Sure, to create an AEM project, there are other ways. For instance:

Anyway, let’s continue with our initial aim. By the way, if you prefer to continue with an official document, please visit this Adobe page: https://docs.adobe.com/content/help/en/experience-manager-learn/getting-started-wknd-tutorial-develop/project-setup.html

Before starting, we need to be sure about two important points: maven should be installed in your computer and its settings file should be configured properly.

To install Maven in your Windows station, you can visit this offical page:https://maven.apache.org/install.html or follow below simple instruction

  • Download the desired version from https://maven.apache.org
  • Put the content of the downloaded zipped file anywhere. Like that:
  • Add the path of the “bin” folder into PATH variable on System Environment Variables
Like that. Yes, it is ugly and I am not good at drawing something!
  • This action may require the rebooting of computer.
  • To check it is done or not, open a command line prompt and type
mvn -v
If yours is similar to this, it’s done.

Ahh, How can I forget this! I assumed that JVM is already installed in your computer!

OK, we are ready now to create an AEM project!

Wait, wait, wait! We have forgotten to update the settings.xml file. This file is located in the .m2 folder. And mainly this .m2 folder should be found under your user folder.

For example:

Find this file and open it. And add new repository into repositories group and set activeProfiles as shown below.

<repositories>
<repository>
<id>adobe-public-releases</id>
<name>Adobe Basel Public Repository</name>
<url>http://repo.adobe.com/nexus/content/groups/public</url>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
....
<repositories>
...
<activeProfiles>
<activeProfile>adobe-public</activeProfile>
</activeProfiles>

OK, I think we are really ready! :)

Open a command-line prompt and go to your target folder. This folder will contain a new AEM Project.

We will run below command but before it if you want to learn which parameter is for what please check this page:

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

In this command, I think the important thing is which archetypeVersion should be use. For this, you can use below table:

PS: More details about archetypes: https://github.com/adobe/aem-project-archetype

+====================+=============================================+
| Archetype Version | AEM Version |
+====================+=============================================+
| 7 | 6.0 or newer |
+--------------------+---------------------------------------------+
| 8 | 6.0 or newer |
+--------------------+---------------------------------------------+
| 9 | 6.0 or newer |
+--------------------+---------------------------------------------+
| 10 | 6.0 or newer |
+--------------------+---------------------------------------------+
| 11 | 6.2 or newer |
+--------------------+---------------------------------------------+
| 12 | 6.3 or newer |
+--------------------+---------------------------------------------+
| 13 | 6.4, 6.3 + SP2 |
+--------------------+---------------------------------------------+
| 14 | 6.4, 6.3 + SP2 |
+--------------------+---------------------------------------------+
| 15 | 6.4, 6.3 + SP2 |
+--------------------+---------------------------------------------+
| 16 | 6.4, 6.3 + SP2 |
+--------------------+---------------------------------------------+
| 17 | 6.4, 6.3 + SP2 |
+--------------------+---------------------------------------------+
| 18 | 6.5, 6.4, 6.3 + SP3 |
+--------------------+---------------------------------------------+
| 19 | 6.5, 6.4, 6.3 + SP3 |
+--------------------+---------------------------------------------+
| 20, 21, 22 | 6.5, 6.4, 6.3 + SP3 |
+--------------------+---------------------------------------------+
| 23 | 6.5, 6.4, 6.3 + SP3, AEM as a Cloud Service |
+--------------------+---------------------------------------------+
| 24 | 6.5.5, 6.4.8.1, AEM as a Cloud Service |
+--------------------+---------------------------------------------+
Source: https://github.com/adobe/aem-project-archetype/blob/master/VERSIONS.md
Hola, it is running.
Yes, our structure is created

Let’s open our new project with our favourite IDE. Mine is Intellij :)

With initial components, all structures and related maven profiles have been created.

Then, deploy time!

Now, our project and code are ready, Go ahead and develop new components!

A Passionate Computer Engineer From İzmir

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store