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

    Copyright 2019 Adobe. All rights reserved.
    This file is licensed to you 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 REPRESENTATIONS
    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">
    
    <parent>
        <groupId>com.adobe.commerce.cif</groupId>
        <artifactId>cif-connector-parent</artifactId>
        <version>0.1.4</version>
        <relativePath>../../parent/pom.xml</relativePath>
    </parent>
    
    <modelVersion>4.0.0</modelVersion>
    <artifactId>cif-connector-content</artifactId>
    <version>0.2.0</version>
    <packaging>content-package</packaging>
    
    <name>CIF Connector - Content Package</name>
    <description>Content Package of Connector for CCIF hosted on openwhisk</description>
    <url>https://github.com/adobe/commerce-cif-connector/content/cif-connector-content</url>
    
    <scm>
        <connection>scm:git:https://github.com/adobe/commerce-cif-connector</connection>
        <developerConnection>scm:git:git@github.com:adobe/commerce-cif-connector.git</developerConnection>
        <url>https://github.com/adobe/commerce-cif-connector/content/cif-connector</url>
        <tag>cif-connector-content-0.2.0</tag>
    </scm>
    <organization>
        <name>Adobe</name>
        <url>https://www.adobe.com</url>
    </organization>
    <licenses>
        <license>
            <name>The Apache License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
        </license>
    </licenses>

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

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
            </plugin>

            <plugin>
                <groupId>com.day.jcr.vault</groupId>
                <artifactId>content-package-maven-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                    <filterSource>${basedir}/META-INF/vault/filter.xml</filterSource>
                    <skipCheckSignature>true</skipCheckSignature>
                    <allowIndexDefinitions>true</allowIndexDefinitions>
                    <verbose>true</verbose>
                    <failOnError>true</failOnError>
                    <group>day/cq60/product</group>
                    <properties>
                        <acHandling>merge_preserve</acHandling>
                    </properties>
                    <failOnMissingEmbed>true</failOnMissingEmbed>
                    <dependencies>
                        <dependency>
                            <group>day/cq60/product</group>
                            <name>cif-virtual-catalog-content</name>
                        </dependency>
                    </dependencies>
                </configuration>
            </plugin>
            
            <plugin>
                <groupId>org.apache.sling</groupId>
                <artifactId>htl-maven-plugin</artifactId>
            </plugin>
            
            <plugin>
                <groupId>org.apache.rat</groupId>
                <artifactId>apache-rat-plugin</artifactId>
                <configuration>
                    <addDefaultLicenseMatchers>true</addDefaultLicenseMatchers>
                    <excludes combine.children="append">
                        <exclude>**/*.xml</exclude>
                        <exclude>**/META-INF/**/*</exclude>
                    </excludes>
                </configuration>
            </plugin>
        </plugins>
    </build>
    
    <dependencies>
        <dependency>
            <groupId>com.adobe.commerce.cif</groupId>
            <artifactId>cif-virtual-catalog-content</artifactId>
            <version>0.2.1</version>
            <type>zip</type>
            <scope>provided</scope>
        </dependency>
    </dependencies>
    
    <profiles>
        <profile>
            <id>autoInstall</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <build>
                <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}${aem.contextPath}/crx/packmgr/service.jsp</targetURL>
                                    <failOnError>true</failOnError>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>
