To get started with AEM development on IntelliJ, the following steps are required.
Each of them is explained in more detail in the remainder of this How-To.
This guide is based on IntelliJ IDEA Ultimate Edition 12.1.4 and AEM 5.6.1.
Download IntelliJ IDEA from the Downloads page at JetBrains.
Then, follow the installation instructions on that page.
Next, set up your project using Maven as described in How-To Build AEM Projects using Apache Maven.
To start working with AEM projects in IntelliJ IDEA, the basic setup in Getting Started in 5 Minutes is sufficient.
IntelliJ IDEA can also provide support in working with JSP, e.g.
Open the Import dialog in IntelliJ IDEA by
In the Import dialog, select the POM file of your project.
Continue with the default settings as shown in the dialog below.
Continue through the following dialogs by clicking Next and Finish.
You are now set up for AEM Development using IntelliJ IDEA
The following steps are necessary for debugging JSPs with IntelliJ IDEA
IntelliJ IDEA needs to understand where to find the JSPs for debugging. As IDEA cannot interpret the
content-package-maven-plugin settings, this needs to be configured manually.
content/src/main/content/jcr_root subdirectoryof your project as shown in the screen shot below.
The last step required is to start AEM with the JVM options proposed by IntelliJ IDEA.
You can do this by starting the AEM jar file directly and adding these options, for example with the following command line:
java -Xdebug -Xrunjdwp:transport=dt_socket,address=58242,suspend=n,server=y -Xmx1024m -jar cq-quickstart-6.5.0.jar
You can also add these options to your start script in
crx-quickstart/bin/start as shown below.
# ... # default JVM options if [ -z "$CQ_JVM_OPTS" ]; then CQ_JVM_OPTS='-server -Xmx1024m -Djava.awt.headless=true' fi CQ_JVM_OPTS="$CQ_JVM_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,address=58242,suspend=n,server=y" # ...
You are now all set up for debugging your JSPs in AEM.
Code in bundles can be debugged using a standard generic remote debug connection. You can follow the Jetbrain documentation on remote debugging.