How to Develop AEM Projects using IntelliJ IDEA How to Develop AEM Projects using IntelliJ IDEA Overview / CQ / AEM How-tos / Development / OVERVIEW 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. • 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 NOTE This guide is based on IntelliJ IDEA Ultimate Edition 12.1.4 and AEM 5.6.1. 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 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 IntelliJ IDEA can also provide support in working with JSP, e.g. • auto-completion of tag libraries • awareness of objects defined by <cq:defineObjects /> and <sling:defineObjects /> 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 1. 2. 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. © 2012 Adobe Systems Incorporated. All rights reserved. Page 1 Created on 2014-09-05 How to Develop AEM Projects using IntelliJ IDEA 3. Continue with the default settings as shown in the dialog below. 4. 5. Continue through the following dialogs by clicking "Next" and "Finish". You are now set up for AEM Development using IntelliJ IDEA 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 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. 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 screen shot below. © 2012 Adobe Systems Incorporated. All rights reserved. Page 2 Created on 2014-09-05 How to Develop AEM Projects using IntelliJ IDEA Install the JSR45 support plugin 1. 2. 3. 4. 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 Configure a Debug Profile 1. 2. 3. 4. 5. 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 don't 6. On the "Startup/Connection" pane, adjust the port if required 7. Copy the command line arguments that IntelliJ IDEA proposes © 2012 Adobe Systems Incorporated. All rights reserved. Page 3 Created on 2014-09-05 How to Develop AEM Projects using IntelliJ IDEA Configure AEM for Debug Mode 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 XX:MaxPermSize=256M -jar cq-quickstart-5.6.1.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 -XX:MaxPermSize=256M -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 © 2012 Adobe Systems Incorporated. All rights reserved. Page 4 Created on 2014-09-05 How to Develop AEM Projects using 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. © 2012 Adobe Systems Incorporated. All rights reserved. Page 5 Created on 2014-09-05
© Copyright 2024