AEM Setup Part 3 : Tools of the Trade

Setup Debugging

To start AEM with debugging enabled you need to pass in the port number via a JVM option when AEM starts.

Set this in start.bat by passing in the following JVM option

-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005

This can also be set if using quickstart jar by passing into the jar command.

java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 -jar aem-author-p4502.jar

Debug AEM from IntelliJ

The first thing to do is create a Remote JVM Debug profile.

You can also set the logging folder to view log output in the debug window.

Repo Tool

Repo tool can be used sync content between your source code and your aem instance. This is useful during your development workflow to test your changes without running a full deploy.

Installing Cygwin
According to the Cygwin website Cygwin is:

A large collection of GNU and Open Source tools which provide functionality similar to a Linux distribution on Windows.
A DLL (cygwin1.dll) which provides substantial POSIX API functionality.

To Install Cygwin navigate to - https://www.cygwin.com/. Download the install .exe and run it.


Select the install directory.


Follow the steps until its complete - you will find cygwin installed at your specified install location.


Install Repo Tool

Install repo from https://github.com/Adobe-Marketing-Cloud/tools/tree/master/repo

Download repo and add to the bin folder in Cygwin, otherwise add it the the Cygwin path.

Setup in IntelliJ

Open External Tools window and add a new entry for the get command as shown below. Make sure to set the program to the bash.exe in your installed cygwin folder.

-l repo get-f $FilePath$

Add another for the put command

-l repo put -f $FilePath$

Now when you right click a file you can access the get and put commands. If you try it out and you get the following error you will need to resolve the missing packages.

To do this run the cygwin installer again, you will see the following screen. Select 'Not Installed' from the view dropdown. Then search the missing packages and select them for install. For me the missing packages were rsync, zip, unzip and curl.

After installing the missing packages cofirm the get/put commands work. If succesful you will see the following output.

Groovy Console


The AEM Groovy Console alows you to run scripts within Adobe Experience Manager using the groovy programming language. Scripts can be created to manipulate content in the JCR. It can also be used to call OSGi services or use AEM, Sling or JCR Api's. I find this usefull at times in development to debug OSGI services in isolation. Scripts can also be executed remotely.

The groovy console package can be downloaded here.

https://github.com/icfnext/aem-groovy-console

To complete the install I am going to demonstrate another install method. Firstly navigate to package manager http://localhost:4502/crx/packmgr/index.js
Click 'upload package' and select your groovy download.

Then click the install button to being the install.

Verify the install by going to http://localhost:4502/groovyconsole

Tune Your local AEM

I find that AEM can at times be slow on development machines to work around this I like to configure the following settings so that the they are more inline with the CPU I am using.

The following configurations can be updated to set the Maximum Parallel Jobs to be 2 or 4.  - it's recomended to set a value of half the CPU cores of your machine.

http://localhost:4502/system/console/configMgr/org.apache.sling.event.impl.jobs.DefaultJobManager
http://localhost:4502/system/console/configMgr/org.apache.sling.event.jobs.QueueConfiguration
http://localhost:4502/system/console/configMgr/org.apache.sling.event.jobs.QueueConfiguration~workflow-timeout

If I am not using the publish instance I also like to disable replication.

http://localhost:4502/etc/replication/agents.author/publish.html

Hotswap Agent

This can be useful in larger projects with slow build and deploy times, hotswap agent will upgrade the default hot-swap ability of the JVM.

This will allow you to hotswap java code without redeploying http://hotswapagent.org/

  1. Download the latest Hotswap JDK dist file https://github.com/TravaOpenJDK/trava-jdk-11-dcevm/releases
  2. Point your java home path at the JDK