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.
- Install Lazybones.
- Create Project Structure using Lazybones.
- Import Generated AEM Project to Eclipse
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.
In order to install Lazybones for creating skeleton project structure in aem follow below steps:-
- Go to link https://bintray.com/pledbrook/lazybones-templates/lazybones#files and the latest lazybones.zip file. currently it is lazybones-0.8.3.zip.
- 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.
Command to create new project using lazybones-
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
Follow below steps to create aem project structure using lazybones:-
- Open command prompt.
- Run below command
lazybones create aem-multimodule-project aemtraining
- Press Enter, it will ask you series of questions. Enter the updated value, if you feel that you dont want default value else just keep pressing enter for default values.
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 aemtraining folder is not available then it creates this folder.
|Maven Group ID||com.myco||groupId|
|Maven Artifact ID||example-project||artifactId|
|Use New Module Naming Convention (core, ui.apps)||yes||useNewNamingConvention|
|Put Bundle in “bundles” sub-directory||no||bundleInBundlesDirectory|
|Bundle Artifact ID||example-project-bundle/example-project.core||bundleArtifactId|
|Content Package Artifact ID||example-project-content/example-project.ui.apps||contentArtifactId|
|Project Name||My AEM Project||projectName|
|Group name for Content Package||my-packages||packageGroup|
|Target AEM Version||6.2||aemVersion|
|Folder to create under /apps||my-aem-project||appsFolderName|
|Folder to use under /content||my-aem-project||contentFolderName|
|Create AEM 6.2 Editable Templates folders?||yes||createEditableTemplatesStructure|
|Folder to create under /conf||my-aem-project||confFolderName|
|Create a site design?||yes||createDesign|
|Design folder name||my-aem-project||designFolderName|
|Create a main client library?||yes||createMainClientLib|
|Create a dependencies client library||yes||createDependenciesClientLib|
|Enable code quality checks?||yes||enableCodeQuality|
|Create Environment-Specific Config Folders?||yes||createRunModeConfigFolders|
|Create Author and Publish Config Folders per Environment?||yes||createAuthorAndPublishPerEnv|
|Set root mapping to /welcome (Classic UI)?||yes in 5.6.1, no in 6.0||reconfigureRootMapping|
|Set Default Authoring UI to Classic? (6.0 only)||yes||enableClassicAuthoringAsDefault|
|Include ACS AEM Commons?||yes||includeAcsAemCommons|
|Include ACS AEM Commons as a sub-package?||yes||includeAcsAemCommonsSubPackage|
|Enable ACS AEM Commons Error Handler?||yes||enableErrorHandler|
|Default Error Page Path||/content/my-aem-project/errors/404||defaultErrorPath|
|Define Error Page Folder for /content/my-aem-project ?||no||defineErrorPageFolder|
|Error Page Folder for /content/my-aem-project||errors||errorFolder|
|Enable ACS AEM Commons Pages Reference Provider?||yes||enablePagesReferenceProvider|
|Enable ACS AEM Commons Design Reference Provider?||yes||enableDesignReferenceProvider|
|Enable ACS AEM Commons Design Html Library Manager?||yes||enableDhlm|
|Enable ACS AEM Commons Versioned Client Libraries?||yes||enableVersionedClientLibs|
|Using Sling Models?||yes||usingSlingModels|
|Sling Models Package||”||slingModelsPackage|
|Purge DAM Workflows?||yes||purgeDamWorkflows|
|DAM Workflow Retention Period (days)||7||purgeDamWorkflowRetention|
Import Generated AEM Project using lazybones to Eclipse:-
- Open eclipse.
- Open the File menu and select Import. In the Import type, select Existing Maven Projects (inside the
- Click Next and Click the Browse button and select your project directory/folder, that you have given at time of generating the project.
- Click Finish. You should be able to see below three projects has been added to your eclipse explorer.
Each for these project serve different purpose:-
- aem-training – This project acts as the container for the two other projects. We should not use this project directly.
- aem-training.core – This project contains Java code which will be deployed to AEM as an OSGi bundle.
- aem-training.ui.apps – This project contains configuration, server-side scripts, client-side scripts, and styling code (CSS). Developers used to spend bulk of their time in this project.