April 25, 2020
Estimated Post Reading Time ~

AEM Developer Tools for Eclipse: Installation and Configuration Guide

AEM eclipse plugin can be used for setting up your development environment for AEM projects quickly.

It provides an AEM perspective which will be very useful, by using the plugin you can:
Integrate AEM server within eclipse
Deploy your code and content directly from eclipse to AEM server
View and edit JCR properties from inside your eclipse
Use sample maven archetype to generate entire project structure along with maven pom files with built in profile that will let you create code and content packages with one click and deploy onto local or remote author and publish server

It support hot code replacement
You can use debug mode to step thru the code
The sample code generated by maven archetype will have scheduler, event handlers, sling model, servlets, Filters, Listeners, sightly components and a sample website as well.

Below are the steps for installing and using AEM Eclipse plugin, as per documentation Eclipse Luna and Kepler version are supported however I have tested this with Mars and it seems to work fine.

1 Open https://eclipse.adobe.com/aem/dev-tools/ and copy the installation link

Open Eclipse, go to Help -> Install new software
Copy the installation link.

Select both AEM and Sling and click on next, accept the terms and install
Click on Windows à Open Perspective à AEM

6.Click on File-> New-> Others-> AEM-> AEM Sample Multi Module Project

The process will take some time to download the artifacts , once done you should see the project structure similar to this.

The main parts of the template are:
* core: Java bundle containing all core functionality like OSGi services, listeners or schedulers, as well as component-related Java code such as servlets or request filters.
* ui.apps: contains the /apps (and /etc) parts of the project, ie JS&CSS clientlibs, components, templates, runmode specific configs as well as Hobbes-tests
* ui.content: contains sample content using the components from the ui.apps
* ui.tests: Java bundle containing JUnit tests that are executed server-side. This bundle is not to be deployed onto production.
* ui.launcher: contains glue code that deploys the ui.tests bundle (and dependent bundles) to the server and triggers the remote JUnit execution

## How to build
To build all the modules run in the project root directory the following command with Maven 3:

mvn clean install

If you have a running AEM instance you can build and package the whole project and deploy into AEM with

mvn clean install -PautoInstallPackage

Or to deploy it to a publish instance, run
mvn clean install -PautoInstallPackagePublish

Or to deploy only the bundle to the author, run
mvn clean install -PautoInstallBundle

## Testing
There are three levels of testing contained in the project:

* unit test in core: this show-cases classic unit testing of the code contained in the bundle. To test, execute:
mvn clean test

* server-side integration tests: this allows to run unit-like tests in the AEM-environment, ie on the AEM server. To test, execute:
mvn clean integration-test -PintegrationTests

* client-side Hobbes.js tests: JavaScript-based browser-side tests that verify browser-side behavior. To test:

in the browser, open the page in 'Developer mode', open the left panel and switch to the 'Tests' tab and find the generated 'MyName Tests' and run them.

Starting the server: in the server window click on start the server, Please note that doing this will connect to a running instance of an AEM server which was configured

To deploy the project into AEM right click on the server and click Add and Remove, and add the modules

Upon successful completion of this steps you should see the example site in the site admin

For deploying and building individual modules via maven right click on the pom files for that module and select run configuration, specify goals as clean install and profile as autoInstallBundle to deploy it on author server

sometime you may get below error while installing via maven

http://localhost:4502/crx/repository/crx.default/apps/example/install/ failed, cause: Installation failed, cause: Conflict

To resolve the error Create the folder “install“if it does not exist into your project via CRXDE lite


By aem4beginner

No comments:

Post a Comment

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