Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

vault filter exclude not working

Avatar

Level 4

Screen Shot 2019-07-17 at 4.53.08 PM.png

Hi,

Everytime I deploy aem application - i18n directory inside my apps/myapp folder getting overridden in crx/de

Scenario:

added two new i18n keys in crx/de apps/myapp and did build and deploy application with following filter.xml and ui.apps pom.xml -

result: above two newly added i18n keys gone for good. overwritten by deployment.

I am thinking something wrong in my pom file (probably content-package-maven-plugin), because when I look at crx/de packagemanager deployed zip file - EDIT - Filter tab - it displays /app/myapp/i18n as excluded .

filter.xml

<?xml version="1.0" encoding="UTF-8"?>

<workspaceFilter version="1.0">

    <filter root="/apps/myapp">

        <exclude pattern="/apps/myapp/install" />

        <exclude pattern="/apps/myapp/i18n(/.*)"/>

    </filter>

</workspaceFilter>

pom.xml

<?xml version="1.0" encoding="UTF-8"?>

<!--

|  Copyright 2015 Adobe Systems Incorporated

|

|  Licensed under the Apache License, Version 2.0 (the "License");

|  you may not use this file except in compliance with the License.

|  You may obtain a copy of the License at

|

|      http://www.apache.org/licenses/LICENSE-2.0

|

|  Unless required by applicable law or agreed to in writing, software

|  distributed under the License is distributed on an "AS IS" BASIS,

|  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

|  See the License for the specific language governing permissions and

|  limitations under the License.

-->

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <!-- ====================================================================== -->

    <!-- P A R E N T  P R O J E C T  D E S C R I P T I O N                      -->

    <!-- ====================================================================== -->

    <parent>

        <groupId>com.mycompany</groupId>

        <artifactId>myapp</artifactId>

        <version>1.0.0-SNAPSHOT</version>

        <relativePath>../pom.xml</relativePath>

    </parent>

    <!-- ====================================================================== -->

    <!-- P R O J E C T  D E S C R I P T I O N                                   -->

    <!-- ====================================================================== -->

    <artifactId>myapp.ui.apps</artifactId>

    <packaging>content-package</packaging>

    <name>mycompany - UI apps</name>

    <description>UI apps package</description>

    <!-- <scm>

        <connection></connection>

        <developerConnection></developerConnection>

        <url></url>

        <tag>HEAD</tag>

    </scm-->

    <!-- ====================================================================== -->

    <!-- B U I L D   D E F I N I T I O N                                        -->

    <!-- ====================================================================== -->

    <build>

        <sourceDirectory>src/main/content/jcr_root</sourceDirectory>

        <resources>

            <!-- define the resources that will go into the package -->

            <resource>

                <directory>${basedir}/src/main/content/jcr_root</directory>

                <excludes>

                    <!-- exclude .vlt control files in the package -->

                    <exclude>**/.vlt</exclude>

                    <exclude>**/.vltignore</exclude>

                    <exclude>**/.gitignore</exclude>

                    <exclude>**/*.iml</exclude>

                    <exclude>**/.classpath</exclude>

                    <exclude>**/.project</exclude>

                    <exclude>**/.settings</exclude>

                    <exclude>**/.DS_Store</exclude>

                    <exclude>**/target/**</exclude>

                    <exclude>**/pom.xml</exclude>

                </excludes>

            </resource>

        </resources>

        <plugins>

            <!--

                we want to keep some of the META-INF files and not configure

                everything in the plugin (mainly the filters).

                copy the resource explicitly instead of attaching it to the default resources

            -->

            <plugin>

                <artifactId>maven-resources-plugin</artifactId>

                <!-- ensure that the empty directories are copied -->

                <configuration>

                    <includeEmptyDirs>true</includeEmptyDirs>

                </configuration>

            </plugin>

            <!-- ====================================================================== -->

            <!-- V A U L T   P A C K A G E   P L U G I N                                -->

            <!-- ====================================================================== -->

            <plugin>

                <groupId>com.day.jcr.vault</groupId>

                <artifactId>content-package-maven-plugin</artifactId>

                <extensions>true</extensions>

                <configuration>

                    <properties>

                        <acHandling>merge_preserve</acHandling>

                    </properties>

                    <filterSource>src/main/content/META-INF/vault/filter.xml</filterSource>

                    <verbose>true</verbose>

                    <failOnError>true</failOnError>

                    <group>myapp</group>

                    <timeout>30</timeout>

                    <embeddeds>

                        <embedded>

                            <groupId>com.mycompany</groupId>

                            <artifactId>myapp.core</artifactId>

                            <target>/apps/myapp/install</target>

                        </embedded>

                    </embeddeds>

                    <subPackages>

                        <subPackage>

                            <groupId>com.adobe.cq</groupId>

                            <artifactId>core.wcm.components.all</artifactId>

                            <filter>true</filter>

                        </subPackage>

                        <subPackage>

                            <groupId>com.adobe.acs</groupId>

                            <artifactId>acs-aem-commons-content</artifactId>

                            <filter>true</filter>

                        </subPackage>

                    </subPackages>

                </configuration>

            </plugin>

            <plugin>

                <groupId>org.apache.sling</groupId>

                <artifactId>htl-maven-plugin</artifactId>

            </plugin>

          

            <!-- ============================== -->

            <!-- Karma runner for Jasmine tests -->

            <!-- ============================== -->

            <plugin>

                <groupId>com.github.eirslett</groupId>

                <artifactId>frontend-maven-plugin</artifactId>

                <version>1.4</version>

                <executions>

                    <!-- 1. Install node and npm locally -->

                    <execution>

                        <id>install node and npm</id>

                        <goals>

                            <goal>install-node-and-npm</goal>

                        </goals>

                        <configuration>

                            <nodeVersion>v6.10.3</nodeVersion>

                            <npmVersion>4.6.1</npmVersion>

                        </configuration>

                    </execution>

                    <!-- 2. Install Karma and Karma plugins (based on package.json) -->

                    <execution>

                        <id>npm install</id>

                        <goals>

                            <goal>npm</goal>

                        </goals>

                    </execution>

                    <!-- 3. Run Karma to execute Jasmine tests -->

                    <execution>

                        <id>javascript tests</id>

                        <goals>

                            <goal>karma</goal>

                        </goals>

                        <phase>test</phase>

                        <configuration>

                            <karmaConfPath>karma.conf.ci.js</karmaConfPath>

                            <failOnError>true</failOnError>

                        </configuration>

                    </execution>

                </executions>

            </plugin>          

          

        </plugins>

    </build>

  

    <!-- ====================================================================== -->

    <!-- P R O F I L E S                                                        -->

    <!-- ====================================================================== -->

  

        <profiles>

       <profile>

            <id>autoInstallPackage</id>

            <activation>

                <activeByDefault>false</activeByDefault>

            </activation>

            <build>

                <pluginManagement>

                    <plugins>

                        <plugin>

                            <groupId>com.day.jcr.vault</groupId>

                            <artifactId>content-package-maven-plugin</artifactId>

                            <executions>

                                <execution>

                                    <id>install-package</id>

                                    <goals>

                                        <goal>install</goal>

                                    </goals>

                                    <configuration>

                                        <targetURL>http://${aem.host}:${aem.port}/crx/packmgr/service.jsp</targetURL>

                                    </configuration>

                                </execution>

                            </executions>

                        </plugin>

                    </plugins>

                </pluginManagement>

            </build>

        </profile>

        <profile>

            <id>autoInstallPackagePublish</id>

            <activation>

                <activeByDefault>false</activeByDefault>

            </activation>

            <build>

                <pluginManagement>

                    <plugins>

                        <plugin>

                            <groupId>com.day.jcr.vault</groupId>

                            <artifactId>content-package-maven-plugin</artifactId>

                            <executions>

                                <execution>

                                    <id>install-package-publish</id>

                                    <goals>

                                        <goal>install</goal>

                                    </goals>

                                    <configuration>

                                        <targetURL>http://${aem.publish.host}:${aem.publish.port}/crx/packmgr/service.jsp</targetURL>

                                    </configuration>

                                </execution>

                            </executions>

                        </plugin>

                    </plugins>

                </pluginManagement>

            </build>

        </profile>

    </profiles>  

    <!-- ====================================================================== -->

    <!-- D E P E N D E N C I E S                                                -->

    <!-- ====================================================================== -->

    <dependencies>

        <dependency>

            <groupId>com.mycompany</groupId>

            <artifactId>myapp.core</artifactId>

            <version>14.0.0-SNAPSHOT</version>

        </dependency>

        <dependency>

            <groupId>com.adobe.aem</groupId>

            <artifactId>uber-jar</artifactId>

            <classifier>apis</classifier>

        </dependency>

        <dependency>

            <groupId>com.adobe.cq</groupId>

            <artifactId>core.wcm.components.all</artifactId>

            <type>zip</type>

        </dependency>

        <dependency>

            <groupId>javax.jcr</groupId>

            <artifactId>jcr</artifactId>

        </dependency>

        <dependency>

            <groupId>javax.servlet</groupId>

            <artifactId>servlet-api</artifactId>

        </dependency>

        <dependency>

            <groupId>com.day.cq.wcm</groupId>

            <artifactId>cq-wcm-taglib</artifactId>

        </dependency>

        <dependency>

            <groupId>com.adobe.acs</groupId>

            <artifactId>acs-aem-commons-content</artifactId>

            <version>3.9.0</version>

            <classifier>min</classifier>

            <type>content-package</type>

        </dependency>

        <dependency>

        <groupId>org.apache.commons</groupId>

        <artifactId>commons-collections4</artifactId>

</dependency>

    </dependencies>

</project>

1 Accepted Solution

Avatar

Correct answer by
Community Advisor
19 Replies

Avatar

Community Advisor

Hi,

In which POM you are updating filter.xml? It should be in apps.ui filter.xml

It should work, please check Jackrabbit Filevault - Workspace Filter

Or you can use update option with include

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



Arun Patidar

Avatar

Level 4

yes ui.apps filter.xml only.

I have other application in my project, which is working fine with same filter xml rules. That is why I am thinking something wrong with POM.xml of ui.apps.

I am not sure if I need to have config.xml, settings.xml in META-INF/vault folder and any changes in POM.xml

Avatar

Level 7

Hi,

Why can't you use the below pattern?

<exclude pattern="/apps/myapp/i18n"/>

Thanks

Tuhin

Avatar

Level 4

I tried that as I mentioned in the original post: It does not work. if resulted zip file does have i18n folder , it is simply installed rather than excluded while installing the package.

<?xml version="1.0" encoding="UTF-8"?>

<workspaceFilter version="1.0">

    <filter root="/apps/myapp">

        <exclude pattern="/apps/myapp/install" />

        <exclude pattern="/apps/myapp/i18n(/.*)"/>

    </filter>

</workspaceFilter>

Avatar

Community Advisor

Hi,

Filters look ok though.

Could you please check Package Coverage from Package Manager It will show what would be added, updated or deleted



Arun Patidar

Avatar

Level 4

Screen Shot 2019-07-18 at 11.10.57 AM.png

I hope - when you say package manager - this is what you are referring to. It has exclude for i18n - but when I download package zip file and check the contents, it has i18n folder and {language}.xml files which are overriding existing i18n key folder in the crx/de.

Avatar

Level 4

This is the worst thing, I could see from AEM , as filter expressions of "exclude" never respected by install maven command - content-pacakge-maven-plugin , I believe.

I had same exclusions issue, when I tried to exclude one of the etc/designs/clientlib ... application specific.

This is not at all working solution.

Based on my trials, it seems include patterns working but not exclude, I might be wrong.

For now, I am telling the client to take out i18n folder, as there are no i18n keys maintained at git level.

I hope Adobe does a better job at this. I have seen bunch of forum questions on this, not a solution.

Avatar

Community Advisor

No, I meant

Coverage option from More.

after and before adding one more exclude just for testing

/apps/appFolder/i18n(/?).*

Screenshot 2019-07-18 at 8.39.56 PM.png



Arun Patidar

Avatar

Level 4

when i click on coverage :

I see below line in dump activity log.

A /apps/myapp/i18n

Avatar

Community Advisor

Ahh, that means it would be part of the installation.

Did you try with another exclude filter, you can add this in directly to the pakage in package manager

/apps/myapp/i18n(/?).*

for me it works, I can't see i18n folder

Screenshot 2019-07-18 at 11.06.06 PM.png

Screenshot 2019-07-18 at 11.05.13 PM.png



Arun Patidar

Avatar

Level 4

I will try this Arun.

I bet this would not work when put in filter.xml, because making changes directly in package manager respecting the filter exclusions.

If you rebuild above package and download it would not contain i18n folder and contents inside in it.

With, maven command install - filter exclusions not respected. and package zip file will have i18n folder, contents inside in it.

Thanks.

Avatar

Level 4

As I said in other comment, what it is doing is "merge" code changes of i18n into crx/de i18n folder. (even with pattern you gave me)

So exclusion in vault filter not works in AEM, unless the ui.apps package zip file DONOT contain i18n directory.

Screen Shot 2019-07-18 at 3.45.45 PM.png

FYI: I had to do have my pom in following way ( and package zip file does not contain i18n folder, deleted i18n folder from code base and pom as follows) , so that it would at-least NOT wipe out existing i18n keys folder from crx/de.

    <build>

        <resources>

            <!-- define the resources that will go into the package -->

            <resource>

                 <!--

                    we want to keep some of the META-INF files and not configure

                    everything in the plugin.

                -->

                <directory>${basedir}/src/main/content/META-INF</directory>

                <targetPath>../vault-work/META-INF</targetPath>

            </resource>

            <resource>

                <directory>${basedir}/src/main/content/jcr_root</directory>

                <excludes>

                    <!-- exclude .vlt control files in the package -->

                    <exclude>**/.vlt</exclude>

                    <exclude>**/.vltignore</exclude>

                    <exclude>**/.gitignore</exclude>

                    <exclude>**/*.iml</exclude>

                    <exclude>**/.classpath</exclude>

                    <exclude>**/.project</exclude>

                    <exclude>**/.settings</exclude>

                    <exclude>**/.DS_Store</exclude>

                    <exclude>**/target/**</exclude>

                    <exclude>**/pom.xml</exclude>

                </excludes>

            </resource>

        </resources>

        <plugins>

            <!--

                we want to keep some of the META-INF files and not configure

                everything in the plugin (mainly the filters).

                copy the resource explicitly instead of attaching it to the default resources

            -->

            <plugin>

                <artifactId>maven-resources-plugin</artifactId>

                <!-- ensure that the empty directories are copied -->

                <configuration>

                    <includeEmptyDirs>true</includeEmptyDirs>

                </configuration>

                <executions>

                    <execution>

                        <id>copy-metainf-vault-resources</id>

                        <phase>generate-resources</phase>

                        <goals>

                            <goal>copy-resources</goal>

                        </goals>

                        <configuration>

                            <outputDirectory>${project.build.directory}/vault-work/META-INF</outputDirectory>

                            <resources>

                                <resource>

                                    <directory>${basedir}/META-INF</directory>

                                    <filtering>false</filtering>

                                </resource>

                            </resources>

                        </configuration>

                    </execution>

                </executions>

            </plugin>

            <!-- ====================================================================== -->

            <!-- V A U L T   P A C K A G E   P L U G I N                                -->

            <!-- ====================================================================== -->

            <plugin>

                <groupId>com.day.jcr.vault</groupId>

                <artifactId>content-package-maven-plugin</artifactId>

                <extensions>true</extensions>

                <configuration>

                    <group>myapp</group>

                    <filterSource>src/main/content/META-INF/vault/filter.xml</filterSource>

                    <verbose>true</verbose>

                    <failOnError>true</failOnError>

                   

                    <embeddeds>

                        <embedded>

                            <groupId>com.mycompany</groupId>

                            <artifactId>myapp.core</artifactId>

                            <target>/apps/myapp/install</target>

                        </embedded>

                    </embeddeds>

                </configuration>

            </plugin>

        </plugins>

    </build>

Thanks.

Avatar

Community Advisor

Hi,

The package would contain everything which in eclipse ui.app module but as part of installation vault filter would be effective.

I used exclude filter in AEM 6.3, works for me in eclipse, I can see the exclusion

I added a new filter for tests to exclude and I had js folder in AEM but not in eclipse and nothing is deleted from AEM

Screenshot 2019-07-19 at 12.31.18 PM.png

Screenshot 2019-07-19 at 12.33.38 PM.png



Arun Patidar

Avatar

Level 4

can you try this for me.

1. Delete test node in CRX/DE

2. build and deploy using mvn clean install -PautoInstallPackage -DskipTests

3. Please let me know, whether tests folder got deployed or not.

If it is not deployed: I would request you share your ui.apps pom.xml if you can. I am thinking, this is more to do with content-package-maven plugin rather than with filter xml.

Thanks again Arun.

Avatar

Community Advisor

Hi,

I deleted tests node from CRXDE. When I deploy from eclipse it does create tests node in CRXDE but It doesn't create content inside and if I created new content in tests folder in CRXDE, the deployment doesn't delete anything.

So the deployment doesn't impact tests folder with exclude rules, means it is working(doesn't create or delete anything tests folder).



Arun Patidar

Avatar

Level 4

Could you please add some new keys in eclipse  (which does not exist in crxde) and deploy? If new keys not merged into crxde, please let me know

Avatar

Community Advisor

Yes, I have new keys in eclipse which are not presents in CRXDE.

Screenshot 2019-07-21 at 1.43.14 PM.png



Arun Patidar

Avatar

Level 4

Could you please share your ui.apps pom.xml , I will try with your pom.xml , I have fitler.xml same as you have.

thanks.

Avatar

Correct answer by
Community Advisor