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

vault filter exclude not working

  • July 17, 2019
  • 19 replies
  • 15468 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

sreedobe
sreedobeAuthor
July 18, 2019

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.

sreedobe
sreedobeAuthor
July 18, 2019

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.

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.

arunpatidar
Community Advisor
Community Advisor
July 19, 2019

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

Arun Patidar
sreedobe
sreedobeAuthor
July 19, 2019

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.

arunpatidar
Community Advisor
Community Advisor
July 20, 2019

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
sreedobe
sreedobeAuthor
July 21, 2019

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

arunpatidar
Community Advisor
Community Advisor
July 21, 2019

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

Arun Patidar
sreedobe
sreedobeAuthor
July 22, 2019

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.

arunpatidar
Community Advisor
arunpatidarCommunity AdvisorAccepted solution
Community Advisor
July 22, 2019