DEV Community

Cover image for Creating an AEM project using Lazybones
Gustavo Hernan Perticarari
Gustavo Hernan Perticarari

Posted on

Creating an AEM project using Lazybones

Hi everyone, this is my first post in this community and I hope you find it interesting. I have been looking for "how to create an AEM project from the scratch" and I did not find good information about it. That's why I decided to create this guide taking all the information that I found and adding my part (obviously).

Adobe is recommending its customers to create AEM project structure using Lazybones instead of traditional Maven archetype 10. As when we create an AEM project using Maven archetype it is not easy to customize, it provides lots of sample content and packages like a test, launcher. Which might not be required for your project, on the contrary, lazybones is very interactive, flexible and easy to customize according to your project need. Adobe Consulting Services (ACS) provides an AEM multi-module template using which you can create AEM projects, which includes a lot of default config options and also provides an option to include the ACS commons package as a subpackage.

The aim of this tutorial is to learn what is lazybones and how we can use it to create an AEM skeleton project structure, as Adobe Consulting Services (ACS) has updated the template version and provided the support for AEM 6.3 also I am going to create project structure for AEM 6.3, for learning I am using windows machine so we are going to install lazybones on windows, but you can install it on Linux and other operating systems also.

What is Lazybones?

Lazybones is a command-line tool and is built in two parts. First, lazybones command-line tool and second project templates.

This command-line tool allows you to create a new project structure for any framework or library for which the tool has a template. Currently, ACS has contributed one template for creating AEM multi-module project, which we are going to use in this tutorial.

How to Install Lazybones?

Mac (2 options)

i. Install Sdkman and then run “sdk install lazybones”
ii. Download lazybones distribution package from BinTray, unzip it and add it to your PATH

Windows

In order to install Lazybones for creating a skeleton project structure in AEM you have to follow below steps:

Go to Lazybones Download Link and download the latest lazybones.zip file. I recommend you the 0.8.3 version

Extract the zip file and set the environment path variable to \lazybones-0.8.3\bin.

Open command prompt and type " lazybones ". If lazybones is successfully installed then you will see a list of available commands, if not, check the environment path variable.

How to create a Project Structure using Lazybones?

Command to create new project using lazybones:
lazybones create "template name" "template version" "target directory"

Example:
lazybones create aem-multimodule-project summit-toys-aem

Start creation of Project

Clarification:

The following steps were carried out to create a new project from scratch and be used to follow the First AEM 6.3 website guide where the project is called "Summit Toys" which I really recommend if you are starting with AEM.

a. Go to the directory where you want to create your new project and run “lazybones create aem-multimodule-project summit-toys-aem” and fill out the following information
b. Maven group ID for the generated project [com.myco]: com.summittoys.aem
c. Maven artifact ID for the generated reactor project [example-project]: summit-toys
d. Use new module naming conventions (core, ui.apps vs. bundle, content) [yes]: yes
e. Put the bundle module in a 'bundles' directory? [no]: no
f. Maven artifact ID for the generated bundle module [summit-toys.core]: summit-toys.core
g. Maven artifact ID for the generated content package module [summit-toys.ui.apps]: summit-toys.ui
h. Maven version for generated project [0.0.1-SNAPSHOT]: 0.0.1-SNAPSHOT
i. Human readable project name [My AEM Project]: Summit Toy Store
j. Group name for Content Package [my-packages]: summit-toys
k. Target AEM version [6.3]: Choices are [6.3, 6.4]: 6.3
l. Include a module to generate dispatcher configuration zip? [no]: no
m. Folder name under /apps for components and templates [summit-toy-store]: summit_toys
n. Folder name under /content which will contain your site [ summit-toy-store ]: summit_toys
o. Would you like to create AEM Editable Templates folders? [yes]: yes
p. Folder name under /conf for editable templates [summit-toy-store]: summit_toys
q. Create a site design (under /etc/designs)? [no]: no
r. Create client libraries under /apps? [yes]:no
s. Do you want to create 'main' client library (at /etc/clientlibs/summit_toys/main having the category summit_toys.main)? [yes]: no
t. Do you want to create 'dependencies' client library (at /etc/clientlibs/summit_toys/dependencies having the category summit_toys.dependencies)? [yes]: no
u. Include ACS standard code quality settings (PMD, Findbugs, Checkstyle, JSLint, jacoco)? [yes]: no
v. Do you want to create run-mode config directories for each environment? [yes]: yes
w. What are the environment names (comma-delimited list)? [localdev,dev,qa,stage,prod]: local,dev,qa,prod
x. Create author and publish runmode directories per environment? [yes]: yes
y. Include ACS AEM Commons as a dependency? [yes]: yes
z. Include ACS AEM Commons as a sub-package? [yes]: yes
aa. Include the 'min' version of ACS AEM Commons (if not, additional dependencies will need to be deployed)? [yes]: yes
bb. Do you want to enable the ACS AEM Commons Error Handler? [yes]: no
cc. Do you want to enable the ACS AEM Commons Pages Reference Provider? [yes]: yes
dd. Do you want to enable the ACS AEM Commons Design Reference Provider? [yes]: yes
ee. Do you want to enable the ACS AEM Commons Versioned Clientlib Rewriter? [yes]: yes
ff. Will you be using Sling Models? [yes]: yes
gg. What package will contain your Sling Models?: com.summit_toys.models
hh. Would you like automatic purging of the DAM workflows? [yes]: yes
ii. How many days should the DAM workflows be retained [7]: 7

Top comments (2)

Collapse
 
magalhaes profile image
André Roberto Figueiró de Magalhães

Thanks for such a nice tutorial with a straight explanation, i'm starting with AEM and became interested into managing the project structure with lazybones.

Collapse
 
gustavoperti profile image
Gustavo Hernan Perticarari

Thanks! Hope it helps you.
If you have any questions please feel free to contact me.