Wednesday, 20 April 2016

AEM Project Structure in Eclipse

AEM Project Structure in Eclipse

AEM Project Structure in Eclipse

We have learnt how to create the AEM project (Maven) structure using AEM archetype in our
previous post here.How to Build AEM project in Eclipse using AEM Archetype.

Now we will see how to use this structure to create AEM applications.

So we have a project structure as follows.
AEM Project Structure in Eclipse

The PARENT Project

The project selected is our parent project and have all the modules.
The main modules are:

1. The CORE Project.
2. The UI APPS Project.
3. The CONTENT Project
AEM Project Structure in Eclipse

The core project

1. This project will contain all the Java code for our application.It can be referred to the backend OSGI bundle for our application.

AEM Project Structure in Eclipse

2. You can make new packages inside src/main/java or delete/edit/modify the existing packages at your free will.

3. You can run a maven "clean install"build on the pom.xml.This will create a OSGI JAR.

AEM Project Structure in Eclipse

4. After the build is successful the OSGI jar can be found inside the target folder of the core project.

AEM Project Structure in Eclipse

5. Now you can upload this JAR seperately in AEM Felix console (/system/console/bundles) and your Java classes will be accessible from our AEM JSPs.

The AEM UI APPS Project

1. This project has the structure of AEM Apps folder.See image below for explanation.

AEM Project Structure in Eclipse

There is also the /etc folder which corresponds to the AEM /etc folder.

2. So this means the apps and etc folder is similar to the /apps and /etc folder in AEM respectively.
Your files should sync from this apps folder to AEM /apps folder to and fro, same for the etc folder as well.

3. If you develop your components in eclipse then running a build and installing the package in AEM will essentially copy the same things under the AEM /apps folder.

4. So after you Maven build the UI APPS project you will end up with a ZIP file (NOT A JAR)

AEM Project Structure in Eclipse

5. Go to the AEM Package Manager to install this.You will see that whatever you have developed under
the /apps folder will be copied under the AEM /apps folder. Under filters you can see the packages that will get installed.

4. The reverse is also true. You can develop your components in AEM and bring them to Eclipse doing the reverse process.

The AEM Content Project

1. The content project corresponds to the /content folder in AEM.

AEM Project Structure in Eclipse

2. If you want to push any media,images (Digital Assets) then the same can be placed under the /dam folder.

3. After building the project if we install the package in AEM the contents we placed under /dam
wii get copied under AEM /content/dam.

No comments:

Post a Comment

Coder Magnet
CoderMagnet is full of resources from our daily development activities. It has solutions for common problematic scenarios in technologies like Java 8, AEM, JCR and also occasionally gives you tips on Blogger as well.