April 26, 2020
Estimated Post Reading Time ~ 1 mins

How to enable merge mode for the packages in AEM

By default the packages build in AEM package manager is enabled with mode "overwrite", this will overwrite the target folder upon installing the package - the local changes under that folder will be lost.

This post explains the approach to enable the merge mode for the packages, this will help us to merge the package content with the repository content.

Create the package with the required path and download to the local file system
merge-mode1

Unzip the package zip file on your computer - jar -xvf test_mode-1.0.zip META-INF/vault/filter.xml

Open the file META-INF/vault/filter.xml in a text editor.

Add mode="merge" to the <filter ...> tag, the merge mode should be added to all the filters defined for example:

<?xml version="1.0" encoding="UTF-8"?>
<workspaceFilter version="1.0">
<filter root="xxxxx" mode="merge" >
<exclude pattern="xxxxx" />
</filter>

<filter root="xxxx" mode="merge"/>
</workspaceFilter>


e.g

<?xml version="1.0" encoding="UTF-8"?>
<workspaceFilter version="1.0">
<filter root="/content/we-retail/us/en/products/women" mode="merge" />
</workspaceFilter>


Available Filter Modes:
"replace" - This is the normal behavior. Existing content is replaced completely by the imported content, i.e. is overridden or deleted accordingly.

"merge" - Existing content is not modified, i.e. only new content is added and none is deleted or modified.

"update" - Existing content is updated, new content is added and none is deleted.

The default filter mode is "replace"

Re-zip the modified package contents so it includes the change - jar -uvf test_mode-1.0.zip META-INF/vault/filter.xml

merge-mode2
Upload the modified package to target server - this will make sure the target server changes are not overwritten.
aem4beginner.blogspot


By aem4beginner

No comments:

Post a Comment

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

Ad Blocker Detected :(

Please consider supporting us by disabling your ad blocker.

Please Disable your adblocker and Refresh the page to view the site content.