{"id":9543,"date":"2024-07-26T13:17:47","date_gmt":"2024-07-26T13:17:47","guid":{"rendered":"https:\/\/axamit.com\/?post_type=glossary-article&#038;p=9543"},"modified":"2024-09-12T10:36:30","modified_gmt":"2024-09-12T10:36:30","slug":"implementing-module","status":"publish","type":"glossary-article","link":"https:\/\/axamit.com\/glossary\/aem\/implementing-module\/","title":{"rendered":"Implementing a Module in Adobe Experience Manager (AEM)"},"content":{"rendered":"<div class=\"custom-toc\"><ul><\/ul><\/div>\n<p class=\"wp-block-paragraph\">Modules in&nbsp;<a href=\"https:\/\/axamit.com\/blog\/adobe-experience-manager\/what-is-aem\/\" data-type=\"post\" data-id=\"2483\">Adobe Experience Manager&nbsp;(AEM)<\/a> are&nbsp;reusable&nbsp;pieces of code that perform specific functions. AEM modules facilitate modularity, which promotes code reuse and separation of concerns. This guide will walk you through the process of implementing a module in AEM.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Key Takeaways<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>AEM modules are reusable pieces of code that facilitate modularity.<\/li>\n\n\n\n<li>Familiarity with <a href=\"https:\/\/axamit.com\/adobe-experience-cloud\/adobe-experience-manager\/\">AEM modules can enhance your development<\/a> capabilities.<\/li>\n\n\n\n<li>Understanding common issues and their solutions can help in successful module implementation.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">AEM Modules<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">AEM modules, a part of the&nbsp;AEM project&nbsp;structure, are used to group related functionalities together. They help in maintaining clean, manageable, and reusable code. Each module can include components,&nbsp;templates, and services that contribute to a specific function.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Creating an AEM Module<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Creating a new module involves the following steps:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Open Your AEM Project:<\/strong>&nbsp;Navigate to your AEM project directory in your code editor or Integrated Development Environment (IDE).<\/li>\n\n\n\n<li><strong>Create a New Module Directory:<\/strong>&nbsp;Create a new directory for your module in the appropriate&nbsp;location&nbsp;based on your project structure.<\/li>\n\n\n\n<li><strong>Add a POM File:<\/strong>&nbsp;Create a new <strong>pom.xml<\/strong> file in your module directory to manage the module\u2019s build configuration.<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Adding Code to the Module<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">After creating the module, you can add code to it:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Create Subdirectories:<\/strong>&nbsp;Create subdirectories for components, templates, or services as required by your module.<\/li>\n\n\n\n<li><strong>Add Code Files:<\/strong>&nbsp;Create and add code files to the appropriate subdirectories. These files could be Java classes,&nbsp;HTL&nbsp;scripts, or other types of files based on your needs.<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Building the Module<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">To build the module, follow these steps:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Navigate to Project Directory:<\/strong>&nbsp;In your terminal or command prompt, navigate to your AEM project directory.<\/li>\n\n\n\n<li><strong>Build the Project:<\/strong>\u00a0Execute the following\u00a0Maven\u00a0command to build your project: mvn clean install.<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Deploying the Module<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Once the module is built, it can be deployed to AEM:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Navigate to CRXDE Lite:<\/strong>\u00a0Access CRXDE Lite in your web browser by appending\u00a0\/crx\/de to your\u00a0AEM instance\u00a0URL.<\/li>\n\n\n\n<li><strong>Import the Module:<\/strong>\u00a0Click on \u201cFile\u201d > \u201cImport\u2026\u201d and choose the .zip file created by the Maven build. This will import your module into AEM.<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Accessing the Module in AEM<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">After deploying the module, it can be accessed in AEM:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Open AEM:<\/strong>&nbsp;Access AEM through your web browser.<\/li>\n\n\n\n<li><strong>Navigate to Module:<\/strong>&nbsp;The location of the module in AEM will depend on the specifics of your project and module.<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Troubleshooting Common Issues<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">During the module implementation process, you might encounter some issues. Here are common issues and their solutions:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Issue<\/th><th>Solution<\/th><\/tr><\/thead><tbody><tr><td>Build fails<\/td><td>Check your pom.xml\u00a0file for errors and ensure all dependencies are correctly specified.<\/td><\/tr><tr><td>Module doesn\u2019t appear in AEM<\/td><td>Verify that the module was correctly imported in CRXDE Lite and that the module\u2019s location in AEM is correct.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Implementing a module in AEM can be a significant step in managing your AEM project effectively. By understanding AEM modules, creating a module, adding code, building and deploying the module, and accessing it in AEM, you can enhance your development capabilities and maintain clean, manageable code. As always, being aware of potential issues and knowing how to troubleshoot them will ensure a smoother implementation process.<\/p>\n","protected":false},"author":12,"featured_media":5015,"menu_order":0,"template":"","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"glossary-category":[131],"class_list":["post-9543","glossary-article","type-glossary-article","status-publish","has-post-thumbnail","hentry","glossary-category-adobe-experience-manager"],"acf":{"post_title":"Implementing Module"},"_links":{"self":[{"href":"https:\/\/axamit.com\/de\/wp-json\/wp\/v2\/glossary-article\/9543","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/axamit.com\/de\/wp-json\/wp\/v2\/glossary-article"}],"about":[{"href":"https:\/\/axamit.com\/de\/wp-json\/wp\/v2\/types\/glossary-article"}],"author":[{"embeddable":true,"href":"https:\/\/axamit.com\/de\/wp-json\/wp\/v2\/users\/12"}],"version-history":[{"count":5,"href":"https:\/\/axamit.com\/de\/wp-json\/wp\/v2\/glossary-article\/9543\/revisions"}],"predecessor-version":[{"id":9862,"href":"https:\/\/axamit.com\/de\/wp-json\/wp\/v2\/glossary-article\/9543\/revisions\/9862"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/axamit.com\/de\/wp-json\/wp\/v2\/media\/5015"}],"wp:attachment":[{"href":"https:\/\/axamit.com\/de\/wp-json\/wp\/v2\/media?parent=9543"}],"wp:term":[{"taxonomy":"glossary-category","embeddable":true,"href":"https:\/\/axamit.com\/de\/wp-json\/wp\/v2\/glossary-category?post=9543"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}