April 19, 2020
Estimated Post Reading Time ~

Vaulting to AEM

Using the CRX (Content Repository eXtreme) via CRXDE can be cumbersome especially for testing, the following are easier ways to interact with the CRX via common IDEs. The basic concept is similar to git whereas to pull and push from the content repository using an IDE as a catalyst.
Note: This post assumes a standard jcr_root structure is being used ex:[repository-base]\content\src\main\content\jcr_root\...
Warning: Transferring content to and from the CRX does not explicitly mean it is saved permanently. If a Maven build is run with a filter that overwrites pushed and changed CRX nodes, changes may be overwritten in CRX. Conversely, if a pull happens from the CRX without changes saved in a (git) repository, the changes could be overwritten locally. Please understand the concepts and ramifications behind using CRX and saving files in a repository 
before attempting to use the products described below.
IntelliJ’s IntelliVault
Install and Setup
  • In the AEM instance's files, locate the FileVault zip. It will be at [instance-location]\crx-quickstart\opt\filevault\filevault.zip.
  • Extract the FileVault zip to a new folder.
  • In IntelliJ, install the IntelliVault plugin via searching File > Settings > Plugins menu or directly at https://plugins.jetbrains.com/plugin/7328?pr=idea
  • After installed, inside File > Settings > Other Settings > IntelliVault
    • Vault Directory: The extracted FileVault location in the previous steps
    • Temp Directory: Commonly store temporary files location
    • CRX Repository URL: The URL of the AEM instance, most commonly http://localhost:4502
    • Username: The username of the AEM instance, most commonly admin
    • Password: The password of the AEM instance, most commonly admin
    • Ignored files: common files that are undesired to be transferred to the JCR
    • JCR Root Directory Name: jcr_root
  • Mapping a keystroke to transfer the file to or from may be desired, I use Control+Shift+P for the push.

Usage: Transferring from CRX

  • Find the content to be pulled
  • To transfer a file from CRX to IntelliJ, create the folder structure mirroring the path desired to retrieved.
  • Right-click on the folder, select IntelliVault > Pull from CRX.
  • The folder will be populated, if available, from what is on CRX.

Usage: Transferring to CRX

  • Below the jcr_root directory in IntelliJ, edit a file normally. I created a file called crx-push-this.html in this example.
  • Typically an mvn build would be done here to get the content/package to the CRX, but instead right-click on the file (or folder) in the project tab, and select IntelliVault > Push to CRX. The file will be transferred to CRX in the path it is currently in relative to the jcr_root folder.
  • Reloading the CRX node, or the page associated with the node should show the changes made to the affected file(s).

Brackets’ AEM Brackets Extension
Brackets is Adobe’s latest endeavor into the front-end IDE market. It contains similar functionality as IntelliVault but is done automatically.
Install and Setup
  • Inside Brackets, File > Extensions manager, search for “AEM Brackets Extension”, and install
  • After the install, the menu has a new option “AEM”. Open AEM > Project Settings. These are similar settings to the IntelliJ version, but less robust
    • Server URL: Typically http://localhost:4502
    • Accept self-signed certificates for HTTPS: Typically unchecked
    • Username: Typically admin
    • Password: Typically admin

Usage

  • Edit file normally, save the file.
  • The file is automatically uploaded to the CRX on save.
  • Note: This can be riskier than the IntelliJ process because if a folder is deleted, it is deleted from CRX automatically also.
  • The manual process for uploading is right-clicking on the file or folder and select ‘Export to Server’
  • To transfer a file from CRX to Brackets, create the folder structure mirroring the path desired to be downloaded
  • Right-click on a file or folder and select ‘Import from Server’

AEM Development Tools for Eclipse

The officially supported AEM Dev Tools can do these CRX push/pull tasks, please see their documentation at: https://docs.adobe.com/docs/en/dev-tools/aem-eclipse.html (documentation) and https://eclipse.adobe.com/aem/dev-tools/ (download).


By aem4beginner

No comments:

Post a Comment

If you have any doubts or questions, please let us know.