In AEM very often we need to synchronize content (html, css, dialogs, nodes and so on) between local AEM instance and development environment. We can achieve this in a few ways:
- deploy content bundle every time when we need content refresh with maven (common approach)
- use some IDE with built-in functionality for synchronization (Eclipse with Sling IDE plugin, Brackets)
There is also exists another way which I’m referrer to synchronize content – to use Jackrabbit FileVault (VLT) which introduces a JCR repository to filesystem mapping.
Let me show in few steps how to configure it (I believe all console commands are self-explained):
- Install the VLT:
- You can obtaine VLT command line client directly from AEM installation directory crx-quickstart/opt/filevault (inside directory build available in two archives tgz and zip) or you can compile it from source code (sources available here)
- Put VLT command line client to system PATH. If it was done correctly you should see output from this command in command line:
vlt --help
- You can obtaine VLT command line client directly from AEM installation directory crx-quickstart/opt/filevault (inside directory build available in two archives tgz and zip) or you can compile it from source code (sources available here)
- Install VLT service on local AEM instance:
vlt --credentials admin:admin sync --uri http://localhost:4502/crx install
If you see output like this:
vlt --credentials admin:admin sync --uri http://localhost:4502/crx install Connecting via JCR remoting to http://localhost:4502/crx/server Preparing to install vault-sync-2.4.34.jar... Detected existing bundle: vault-sync-2.4.34.jar. Aborting installation. Specify --force to update.
It means that service was already installed on AEM but you can override/update it with –force parameter like below:
vlt --credentials admin:admin sync --uri http://localhost:4502/crx install --force
- Open console in content JCR_ROOT folder (folder with content – check folder path for example) and register it for synchronization:
vlt --credentials admin:admin sync --uri http://localhost:4502/crx/server/-/jcr:root register
- Afterwards all modifications of content from development environment will be synchronized with OAK without additional actions.
- Check that folder from #3 was added for synchronization:
vlt --credentials admin:admin sync --uri http://localhost:4502/crx status Connecting via JCR remoting to http://localhost:4502/crx/server Listing sync status for http://localhost:4502/crx/server/-/jcr:root - Sync service is enabled. - syncing directory: /home/evgeniy_fitsner/dev/test_project/content/src/main/content/jcr_root
As we see from the log everything is good.
For more information about VLT and what can be done with it please read documentation: