Tuesday 2 May 2017

Create AEM porject structure using Lazybones

Lazybones is a command line tool to create AEM project structure. Adobe is recommending its customers to create AEM project structure using Lazybones instead of traditional Maven archetype 10. As when we create a aem project using Maven archetype it is not easy to customize, it provides lots of sample content and packages like test, launcher. Which might not be required for your project, on contrary lazybones bones is very interactive , flexible and easy to customize according to your project need. Adobe consulting Services (ACS) provides a aem multi module template using which you can create AEM projects, which includes lot of default config options and also provides an option to include the ACS commons package as a sub package.
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.
Lazybones Overview:- Lazybones is a command line tool and is build 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. You can also contribute templates by sending pull requests to this GitHub project or publishing the packages to the relevant Bintray repository.


Install Lazybones

In order to install Lazybones for creating project skeleton in aem follow below steps:-

  • 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 list of available commands as shown below.
Note:- If you get error like lazybones is not a command, then check environment path is configured correctly or download the package again as it might be corrupted.

Create project structure using Lazybones

Command to create new project

lazybones create <template name> <template version> <target directory>


Note:- Here template version is optional and if you leave it out, Lazybones will install the latest version of the template it can find.

Steps to create project using Lazybones:
  • Open command prompt.
  • Run below command

lazybones create aem-multimodule-project 1.0 D:/CQ5/Projects/lazybones-0.8.3/project

Here template name is aem-multimodule-project, if we use any custom template then it will show below error.
If version entered is wrong, then we will get below error.

Press enter after entering the create command. Enter required info.


Note:- Here create is the lazybone command, aem-multimodule-project is acs common template name for creating the project and aemtraining is the folder/directory name where i want to create my project. If target folder is not available then it creates this folder.


Build and Install Project

Run below command to install the lazybones project in aem
mvn clean install



No comments :

Post a Comment