vault filter exclude not working | Community
Skip to main content
sreedobe
Level 4
Jul 17, 2019 11:51 PM UTC
Solved

vault filter exclude not working

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.
arunpatidar
arunpatidarAccepted solution
New Participant
Jul 22, 2019 10:47 AM UTC

19 replies

arunpatidar
arunpatidarAccepted solution
New Participant
Jul 22, 2019 10:47 AM UTC
sreedobe
sreedobeAuthor
Level 4
Jul 22, 2019 2:04 AM UTC

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.

Translate
arunpatidar
New Participant
Jul 21, 2019 11:45 AM UTC

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

Translate
Arun Patidar
sreedobe
sreedobeAuthor
Level 4
Jul 21, 2019 4:15 AM UTC

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

Translate
arunpatidar
New Participant
Jul 20, 2019 11:51 AM UTC

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).

Translate
Arun Patidar
sreedobe
sreedobeAuthor
Level 4
Jul 19, 2019 5:18 PM UTC

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.

Translate
arunpatidar
New Participant
Jul 19, 2019 10:37 AM UTC

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

Translate
Arun Patidar
sreedobe
sreedobeAuthor
Level 4
Jul 18, 2019 10:57 PM UTC

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.

Translate
sreedobe
sreedobeAuthor
Level 4
Jul 18, 2019 10:21 PM UTC

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.

Translate
arunpatidar
New Participant
Jul 18, 2019 9:06 PM UTC

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

Translate
Arun Patidar