Ad Code

Thursday, March 23, 2017

Create Multiple Bundles in an AEM Maven Project


In AEM, Maven provides multi-module architecture.

What does it mean??
It means that we can have different modules like bundle and content(core,ui.apps) in a single project.

In this blog, we will discuss that how can we create multiple bundles in the same project.
Initially, when we create an AEM Project, we always see two modules:
  1. Bundle
  2. Content
Fig- Initial modules provided by maven-archetype

These modules are defined under parent Pom.xml.
Fig- Modules configuration in parent Pom.xml

Problem Statement: I want to create multiple bundles in the same AEM Project. The use cases of doing this can be:

  • Need a bundle to run in publish instance only or need to deploy a bundle on the basis of specific locations.
  • Want to create multiple bundles in a single project on the basis of big functionalities like Login Module, Payment Module etc.

Solution: It is very easy, you just need to follow the below Steps:
  • Create the new bundle by just copying the existing bundle of a project.
add a new bundle.PNG
Fig - New Bundle created by copying the existing bundle

  • Rename the bundle1 ( i.e., test) .Now In Pom.xml of Test bundle change the ArtifactID (Because artifact should be unique for each module of the project).
Fig- Rename the copied bundle and change the artifact id in Pom.xml of new bundle

  • Change the “Bundle-SymbolicName”  in the Test Module Pom.xml.
Fig- Change the Bundle-SymbolicName in Pom.xml of Test Module

  • Add a new module in parent Pom.xml.
Fig- Adding Test Module in Parent Pom.xml

  • Content Pom.xml  contains the dependency of all the bundles, so we need to add the dependency of the new bundle(test-module) in this Pom.xml
add dependency.PNG
Fig- Add the dependency of Test Bundle in Content(ui.apps) Pom.xml

  • For deploying the bundles at any specific location we need to specify the location in the "target" (like install) and bundle ‘s groupId and artifactid in the embedded section.
Fig- Configuring the embedded section in Content(ui.apps) Pom.xml

  • Now you just need to build the code and you can find the bundle’s jar at expected location as you configured in content Pom.xml in embedded section.
Fig- Showing bundles at specific location
By following the above steps you can create n number of bundles in a single AEM project.

Find the git repository from here .

If you have any query or suggestion then kindly comment or mail us at

Thanks and Happy Learning 😊

No comments:

Post a Comment