若要開始使用IntelliJ上的AEM開發,需執行下列步驟。
在本作法的其餘部分中,會更詳細地說明每個選項。
本指南以IntelliJ IDEA Ultimate Edition 12.1.4和AEM 5.6.1為基礎。
從下載IntelliJ IDEA JetBrains的下載頁面.
接著,請依照該頁面上的安裝指示操作。
接下來,使用Maven設定專案,如 如何使用Apache Maven建立AEM專案.
若要開始在IntelliJ IDEA中使用AEM專案,請參閱 5分鐘後快速入門 已足夠。
IntelliJ IDEA也可提供使用JSP的支援,例如
<cq:defineObjects />
和 <sling:defineObjects />
要讓此功能發揮作用,請遵循 如何使用JSP in 如何使用Apache Maven建立AEM專案.
開啟 匯入 IntelliJ IDEA中的對話方塊
在「匯入」對話方塊中,選取專案的POM檔案。
繼續進行下列對話方塊中顯示的預設設定。
按一下,繼續進行下列對話方塊 下一個 和 完成.
您現在已透過IntelliJ IDEA設定為AEM開發
使用IntelliJ IDEA調試JSP時需要執行以下步驟
IntelliJ IDEA需要了解在何處查找用於調試的JSP。 由於IDEA無法解譯 content-package-maven-plugin
設定,則需要手動設定。
content/src/main/content/jcr_root subdirectory
如下方螢幕擷取畫面所示。
最後一個步驟是使用IntelliJ IDEA提議的JVM選項啟動AEM。
您可以直接啟動AEM jar檔案並新增這些選項(例如使用下列命令列)來執行此操作:
java -Xdebug -Xrunjdwp:transport=dt_socket,address=58242,suspend=n,server=y -Xmx1024m -XX:MaxPermSize=256M -jar cq-quickstart-5.6.1.jar
您也可以將這些選項新增至您的開始指令碼中 crx-quickstart/bin/start
如下所示。
# ...
>[!CAUTION]
>
>AEM 6.4 has reached the end of extended support and this documentation is no longer updated. For further details, see our [technical support periods](https://helpx.adobe.com/tw/support/programs/eol-matrix.html). Find the supported versions [here](/docs/?lang=zh-Hant).
# default JVM options
>[!CAUTION]
>
>AEM 6.4 has reached the end of extended support and this documentation is no longer updated. For further details, see our [technical support periods](https://helpx.adobe.com/tw/support/programs/eol-matrix.html). Find the supported versions [here](/docs/?lang=zh-Hant).
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"
# ...
>[!CAUTION]
>
>AEM 6.4 has reached the end of extended support and this documentation is no longer updated. For further details, see our [technical support periods](https://helpx.adobe.com/tw/support/programs/eol-matrix.html). Find the supported versions [here](/docs/?lang=zh-Hant).
現在,您都已設定為在AEM中調試JSP。
可以使用標準通用遠程調試連接調試套件中的代碼。 您可以遵循 遠程調試的Jetbrain文檔.