Import the Maven Project

  1. Open the Import dialog in IntelliJ IDEA by

    • selecting Import Project on the welcome screen if you have no project open yet
    • selecting File > Import Project from the main menu
  2. In the Import dialog, select the POM file of your project.

    chlimage_1-45

  3. Continue with the default settings as shown in the dialog below.

    chlimage_1-46

  4. Continue through the following dialogs by clicking Next and Finish.

  5. You are now set up for AEM Development using IntelliJ IDEA

    chlimage_1-47

Debugging JSPs with IntelliJ IDEA

The following steps are necessary for debugging JSPs with IntelliJ IDEA

  • Set up a Web Facet in the Project
  • Install the JSR45 support plugin
  • Configure a Debug Profile
  • Configure AEM for Debug Mode

Set up a Web Facet in the Project

IntelliJ IDEA must understand where to find the JSPs for debugging. Because IDEA cannot interpret the content-package-maven-plugin settings, it must be configured manually.

  1. Go to File > Project Structure
  2. Select the Content module
  3. Click + above the list of modules and select Web
  4. As the Web Resource Directory, select the content/src/main/content/jcr_root subdirectory of your project as shown in the screenshot below.

chlimage_1-48

Install the JSR45 support plugin

  1. Go to the Plugins pane in the IntelliJ IDEA settings
  2. Navigate to the JSR45 Integration Plugin and select the check box next to it
  3. Click Apply
  4. Restart IntelliJ IDEA when requested to

chlimage_1-49

Configure a Debug Profile

  1. Go to Run > Edit Configurations
  2. Hit the + and select JSR45 Remote
  3. In the configuration dialog, select Configure next to Application Server and configure a Generic server
  4. Set the start page to an appropriate URL if you want to open a browser when you start debugging
  5. Remove all Before launch tasks if you use vlt autosync, or configure appropriate Maven tasks if you do not
  6. On the Startup/Connection pane, adjust the port, if necessary
  7. Copy the command-line arguments that IntelliJ IDEA proposes

chlimage_1-50 chlimage_1-51

Configure AEM for Debug Mode

The last step required is to start AEM with the JVM options proposed by IntelliJ IDEA.

Start 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"

# ...

Start Debugging

You are now all set up for debugging your JSPs in AEM.

  1. Select Run > Debug > Your Debug Profile
  2. Set breakpoints in your component code
  3. Access a page in your browser

chlimage_1-52

Debugging Bundles with IntelliJ IDEA

Code in bundles can be debugged using a standard generic remote debug connection. You can follow the Jetbrain documentation on remote debugging.

Experience Manager


Elevate and Empower Teams with Agentic AI for Exceptional Experiences

Online | Strategy Keynote | General Audience

Elevate and empower your CX teams with AI that transforms creativity, personalization, and productivity. Discover how Adobe is...

Tue, Mar 18, 1:00 PM PDT (8:00 PM UTC)

Register

Rapid Feature Releases with AEM Cloud: Telegraph Media Group’s RDE Strategy

Online | Session | Intermediate

Hear how Telegraph Media Group, the award-winning publisher of The Daily Telegraph, The Sunday Telegraph, The Telegraph Magazine,...

Wed, Mar 19, 3:30 PM PDT (10:30 PM UTC)

Register

Connect with Experience League at Summit!

Get front-row access to top sessions, hands-on activities, and networking—wherever you are!

Learn more