My usecase is, I have multiple folders below /apps/myproject. Previously all folders were using default replace mode, so filter.xml was simply <filter root="/apps/myproject"/>
. But I have to make one child folder alone into merge mode and keep remaining folders with replace. We will also be adding more folders in future, so want to keep filter.xml flexible to accommodate future folders as well.
One way to do this is to split the definition as:
<filter root="/apps/myproject/folder1"/>
<filter root="/apps/myproject/folder2"/>
.
.
<filter root="/apps/myproject/folder12" mode="merge" />
.
.
<filter root="/apps/myproject/foldern"/>
Is there an elegant way to hijack and exclude the folder12 into merge mode?
I thought this should be easy with an exclude-rule. But as I tested it, there is a bug. Unfortunately the order of rules in the filter.xml matters. The filter-rule of the special folder must be before the general rule with the exclude-rules.
This order worked for me:
<?xml version="1.0" encoding="UTF-8"?>
<workspaceFilter version="1.0">
<filter root="/apps/myproject/folder12" mode="merge"/>
<filter root="/apps/myproject">
<exclude pattern="/apps/myproject/folder12(/.*)?"/>
</filter>
</workspaceFilter>
I haven't checked where the bug is coming from. But probably from the backward-compatibility with the days, when there was no mode-property. In CQ5.6 was still the rule, that any folder without filter.xml rule is merging, and all paths covered by a filter are replaced.