What does it mean?
It means that we can have different modules like bundles and content(core,ui.apps) in a single project.
In this blog, we will discuss how can we create multiple bundles in the same project.
Initially, when we create an AEM Project, we always see two modules: - Bundle
- 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.
- Create the new bundle by just copying the existing bundle of a project.
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 a 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
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 the 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.
No comments:
Post a Comment
If you have any doubts or questions, please let us know.