vault filter exclude not working | Community
Skip to main content
sreedobe
Level 4
July 17, 2019
Solved

vault filter exclude not working

  • July 17, 2019
  • 19 replies
  • 15489 views

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>

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

19 replies

arunpatidar
Community Advisor
Community Advisor
July 18, 2019

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
sreedobe
sreedobeAuthor
Level 4
July 18, 2019

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

Tuhin_Ghosh
Level 8
July 18, 2019

Hi,

Why can't you use the below pattern?

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

Thanks

Tuhin

sreedobe
sreedobeAuthor
Level 4
July 18, 2019

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>

arunpatidar
Community Advisor
Community Advisor
July 18, 2019

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
sreedobe
sreedobeAuthor
Level 4
July 18, 2019

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.

sreedobe
sreedobeAuthor
Level 4
July 18, 2019

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.

arunpatidar
Community Advisor
Community Advisor
July 18, 2019

No, I meant

Coverage option from More.

after and before adding one more exclude just for testing

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

Arun Patidar
sreedobe
sreedobeAuthor
Level 4
July 18, 2019

when i click on coverage :

I see below line in dump activity log.

A /apps/myapp/i18n

arunpatidar
Community Advisor
Community Advisor
July 18, 2019

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

Arun Patidar