April 10, 2020
Estimated Post Reading Time ~

Setting up AEM Development Environment

Prerequisites
To set up a development environment, we need the following -
  1. Java should be installed (preferably JDK 1.8)
  2. Eclipse IDE (preferably Eclipse-Photon). You can also use other IDEs such as IntelliJ IDEA.
  3. Maven should be installed (preferably 3.5.3)
Below steps can be followed to set up a development environment

Installing AEM Plugin
Open Eclipse and go to the Help menu and then select Eclipse Marketplace...

Eclipse Marketplace

After opening Eclipse Marketplace, you will see a popup. In this popup, enter AEM in the Find bar. It will search through the web and will display the AEM plugin for eclipse. Click on Install.

Install the AEM plugin

Accept the License agreement and Finish

License Agreement and Finish The eclipse will take some time to install the software and will show a popup. Click on Install Anyway.

Security Warning

Once the software is installed, Restart Eclipse to reflect changes.

Installing AEM Developer Tools
AEM developer tools provide us with many features such as integration of AEM server and eclipse, sync of content and bundles, debugging, modification of JCR properties, and many more.
To install AEM Developer tools, follow the below steps -
Go to the AEM Developer Tools site.
You will see an Installation Link. Copy it.

Installation Link

In Eclipse, go to Help, then Install New Software...

Install New Software

Click Add..., then in the name field, put "AEM Developer Tools" and in the location field. paste the installation link.

Click Next, Next, and Finish. Restart the eclipse so the new changes are reflected.
Create a New Project

Go to New, then New Project, then Other and select AEM Multimodule Project and click Next

AEM Multimodule project

Select Maven Archetype 14, click Next

Maven Archetype

Put the required fields as shown in the figure and click on Next

Project properties

Select Don't deploy on a server and click Finish

Finish

The project will be created will a default template. This will have the following children projects - core, launcher, tests, apps, and content.
Connecting with AEM Server
In this section, we will see how can we connect our AEM server to our eclipse code.

Go to AEM Perspective and in the Servers tab, click on create a new server

Add new server

Add resources to the server and click Finish


Add resources

Once the server is created, we can configure it by double-clicking on the same

Configuring Server

After configuration, right-click on the server and start it.

Starting the server

Once the server is started, you can import and export content from and to the AEM instance.
After doing these steps, our AEM server and Eclipse are connected and we can sync them accordingly.
Installing bundle in AEM using eclipse
We can also install our bundle in the AEM server via eclipse. Below are the required steps -

Select all the maven projects and right-click. Then Run As and
then Run Configurations...


Run Configurations

Select Maven Build from the options and double click to create a new configuration. Fill the required values and click Apply and Run

Run

Once the project is built successfully, you will see the following message in the console

[INFO] Reactor Summary:
[INFO]
[INFO] demo 0.0.1-SNAPSHOT ................................ SUCCESS [ 2.194 s]
[INFO] Demo Project - Core ................................ SUCCESS [ 17.958 s]
[INFO] Demo Project - UI apps ............................. SUCCESS [ 22.312 s]
[INFO] Demo Project - UI content .......................... SUCCESS [ 4.428 s]
[INFO] Demo Project - Integration Tests Bundles ........... SUCCESS [ 3.694 s]
[INFO] Demo Project - Integration Tests Launcher 0.0.1-SNAPSHOT SUCCESS [ 16.746 s]
[INFO] ---------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ---------------------------------------------------------------
[INFO] Total time: 01:13 min
[INFO] Finished at: 2018-10-09T10:26:47+05:30
[INFO] ---------------------------------------------------------------

You can go to ./system/console/bundles in AEM and see your bundle will be installed. Check if the bundle is in the Active state. If it is not, then we need to rectify it accordingly.

Conclusion
So finally, we have reached the end of this post. In this post, we set up the development environment for the AEM and also saw how can we connect AEM with our custom project.


By aem4beginner

No comments:

Post a Comment

If you have any doubts or questions, please let us know.