Back to the blog
Technology

Simplify Your AEM Coding With Vault:Syncing between Disk and Server

author image

Akshay Rathnavas

Date posted: February 19, 2020


Since it’s inception, Adobe Experience Manager has provided it’s own IDE, CRXDE Lite . Anyone who used it will know the difficulty in coding in it, when it clearly has no IntelliSense or a proper syntax checker. Coding in a better IDE such as JetBrains IntelliJ or Eclipse or Adobe’s own Brackets is much easier.
While there are vault tools available for the syncing of files to and from the CRX Server, there is a lack of integrated documentation for the proper installation and setup of these. Hopefully, the below excerpts will bridge this gap, providing a seamless integration of AEM Server with any IDE.

Method 1: Using NPM (One-Way Auto Sync)

One of the popular ways to push your code to the repository is using an NPM plugin created for the same. The only disadvantage of this is, you can only push it, and it lacks an import option.

Steps

  • Open CMD or any terminal of your choice. Install NPM if you do not have it already. (Go to https://www.npmjs.com/get-npm).
  • Once NPM is installed, run this following command to install the AEM Sync Plugin

        npm i aemsync -g  
    
  • Once aemsync is installed, run this following command in your preferred terminal.

      aemsync -t http://admin:admin@localhost:4502  -w \path\to\workspace  
    
  • This can also be run with only the command aemsync from the desired workspace, and it will take the default parameters.You can also use it with the publisher instance by mentioning the respective URL and Port .More about it’s documentation is found here https://www.npmjs.com/package/aemsync
  • Now, every files and folders under the mentioned path will be automatically synced (only export) with the CRX Server when there is a change in the file/folder.

PROS

  • Independent of any IDE.
  • Syncing is automatic.

CONS

  • Only provides one-way syncing, from disk to server.

Method 2: Using IntelliVault Plugin (Two-Way Manual Sync)

JetBrains is known for making great IDEs and IntelliJ is one such IDE.There are several features available OOTB, and a vast marketplace to complement it with plugins. IntelliVault is precisely one such plugin to make the lives of (AEM) Developers easier.

Steps

  • Open IntelliJ , and Go to File –> Settings ( Alt+Ctrl+S). Select Plugins
  • Select the Marketplace tab and search for IntelliVault . Click Install , and once it’s done, restart the IDE.
  • Before we proceed to Sync our files, we need to configure a few things in the Settings.
  • Open IntelliJ, and Go to File Settings(Alt+Ctrl+S). Select Tools –> IntelliVault.
    Make the below configuration for the Vault Directory field. If your corresponding directory has the vault-cli-xx.zip , then unzip it, and make the below setting/field point to the unzipped folder.
  • If there is any other configuration to be changed (like username, password, Repository) depending on which environment you are using, make the corresponding changes, and Click OK.
  • Now you’re ready to Import from Server and Export to Server. To do this, right click your relevant files/directory–> IntelliVault –> Pull from CRX/ Push to CRX

PROS

  • Provides two-way sync options.

CONS

  • Requires manual sync.
  • Works only with Jetbrains IntelliJ IDE

Method 3: Using AEM Brackets Extension (Two-Way Manual Sync)

Brackets is a popular open-source IDE provided by Adobe . It is comparatively lighter in weight and features it’s own local server.

Steps

  • Open Brackets. Go to File–> Extension Manager.
  • Search for AEM Brackets Extension and install it. Restart Brackets.
  • Open the AEM Projects folder in Brackets. Right click any file/folder you want to sync.
  • Use the options Import from Server or Export to Server

PROS

  • Provides two-way sync options.

CONS

  • Requires manual sync.
  • Works only with Adobe Brackets


Miscellaneous Notes:

  • Only the files under the apps module (under jcr_root) will be available for syncing. For all the other changes, such as changes in Java files or dependencies added to pom.xml files, a complete package build and install needs to be done since the bytecode needs to be generated and deployed to OSGI as bundles.
  • In IntelliJ, if any error occurs while executing the Import/Export option, kindly check if the System/ Project Java version matches with, or is compatible the Java version of the IntelliVault plugin.
Browse all categories