How to Develop AEM Projects using IntelliJ IDEA
how-to-develop-aem-projects-using-intellij-idea
Last update: Wed Apr 17 2024 00:00:00 GMT+0000 (Coordinated Universal Time)
Overview
overview
To get started with AEM development on IntelliJ, the following steps are required.
Each step is explained in more detail in the remainder of this topic.
Install IntelliJ
Set up your AEM project based on Maven
Prepare JSP support for IntelliJ in the Maven POM
Import the Maven Project into IntelliJ
Install IntelliJ IDEA
install-intellij-idea
Download IntelliJ IDEA from
the Downloads page at JetBrains
.
Then, follow the installation instructions on that page.
Set up your AEM project based on Maven
set-up-your-aem-project-based-on-maven
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.
Prepare JSP Support for IntelliJ IDEA
prepare-jsp-support-for-intellij-idea
IntelliJ IDEA can also provide support in working with JSP, for example:
For that to work, follow the instructions on
How-To Work with JSPs
in
How-To Build AEM Projects using Apache Maven
.
Import the Maven Project
import-the-maven-project
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
In the Import dialog, select the POM file of your project.
Set up a Web Facet in the Project
Install the JSR45 support plugin
Configure a Debug Profile
Configure AEM for Debug Mode
Go to
File > Project Structure
Select the
Content
module
Click
+
above the list of modules and select
Web
As the Web Resource Directory, select the
content/src/main/content/jcr_root subdirectory
of your project as shown in the screenshot below.
Go to the
Plugins
pane in the IntelliJ IDEA settings
Navigate to the
JSR45 Integration
Plugin and select the check box next to it
Click
Apply
Restart IntelliJ IDEA when requested to
Go to
Run > Edit Configurations
Hit the
+
and select
JSR45 Remote
In the configuration dialog, select
Configure
next to
Application Server
and configure a Generic server
Set the start page to an appropriate URL if you want to open a browser when you start debugging
Remove all
Before launch
tasks if you use vlt autosync, or configure appropriate Maven tasks if you do not
On the
Startup/Connection
pane, adjust the port, if necessary
Copy the command-line arguments that IntelliJ IDEA proposes
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'
CQ_JVM_OPTS="$CQ_JVM_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,address=58242,suspend=n,server=y"
# ...
Debugging Bundles with IntelliJ IDEA 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.
recommendation-more-help