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

    Copyright 2017 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">
  <modelVersion>4.0.0</modelVersion>

  <!-- ====================================================================== -->
  <!-- B U I L D   D E F I N I T I O N                                        -->
  <!-- ====================================================================== -->
  <parent>
    <groupId>com.adobe.aio.aem</groupId>
    <artifactId>aio-aem</artifactId>
    <relativePath>../pom.xml</relativePath>
    <version>1.0.2</version>
  </parent>

  <artifactId>aio-aem-events</artifactId>
  <description>Adobe I/O - AEM Events Package</description>
  <name>Adobe I/O - AEM Events Package</name>

  <packaging>content-package</packaging>

  <build>

    <sourceDirectory>src/main/content/jcr_root</sourceDirectory>
    <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>
        <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 S                              -->
      <!-- ====================================================================== -->
      <plugin>
        <groupId>org.apache.jackrabbit</groupId>
        <artifactId>filevault-package-maven-plugin</artifactId>
        <configuration>
          <properties>
            <cloudManagerTarget>none</cloudManagerTarget>
          </properties>
          <packageType>container</packageType>
          <jcrRootSourceDirectory>${project.basedir}/src/${cfg.context}/content/jcr_root</jcrRootSourceDirectory>
        </configuration>
        <extensions>true</extensions>
      </plugin>
      <plugin>
        <groupId>com.day.jcr.vault</groupId>
        <artifactId>content-package-maven-plugin</artifactId>
        <configuration>
          <failOnError>true</failOnError>
          <verbose>true</verbose>
        </configuration>
        <extensions>true</extensions>
      </plugin>

      <plugin>
        <groupId>org.apache.sling</groupId>
        <artifactId>htl-maven-plugin</artifactId>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>aemaacs</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <properties>
        <cfg.context>cs</cfg.context>
      </properties>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.jackrabbit</groupId>
            <artifactId>filevault-package-maven-plugin</artifactId>
            <configuration>
              <embeddeds>
                <embedded>
                  <groupId>com.adobe.aio.aem</groupId>
                  <artifactId>aio-aem-core</artifactId>
                  <target>/apps/aio-aem-events/install</target>
                </embedded>
                <embedded>
                  <groupId>com.adobe.aio.aem</groupId>
                  <artifactId>aio-lib-osgi</artifactId>
                  <target>/apps/aio-aem-events/install</target>
                </embedded>
                <embedded>
                  <groupId>com.adobe.aio.aem</groupId>
                  <artifactId>aio-aem-events-mgmt</artifactId>
                  <target>/apps/aio-aem-events/install</target>
                </embedded>
                <embedded>
                  <groupId>com.adobe.aio.aem</groupId>
                  <artifactId>aio-aem-events-publish</artifactId>
                  <target>/apps/aio-aem-events/install</target>
                </embedded>
                <embedded>
                  <groupId>com.adobe.aio.aem</groupId>
                  <artifactId>aio-aem-events-osgi-mapping</artifactId>
                  <target>/apps/aio-aem-events/install</target>
                </embedded>
              </embeddeds>
            </configuration>
          </plugin>
        </plugins>
      </build>
      <dependencies>
        <dependency>
          <groupId>com.adobe.aio.aem</groupId>
          <artifactId>aio-aem-events-osgi-mapping</artifactId>
          <version>${project.version}</version>
        </dependency>
        <dependency>
          <groupId>com.adobe.aio.aem</groupId>
          <artifactId>aio-aem-events-publish</artifactId>
          <version>${project.version}</version>
        </dependency>
        <dependency>
          <groupId>com.adobe.aio.aem</groupId>
          <artifactId>aio-aem-events-mgmt</artifactId>
          <version>${project.version}</version>
        </dependency>
        <dependency>
          <groupId>com.adobe.aio.aem</groupId>
          <artifactId>aio-aem-core</artifactId>
          <version>${project.version}</version>
        </dependency>
        <dependency>
          <groupId>com.adobe.aio.aem</groupId>
          <artifactId>aio-lib-osgi</artifactId>
          <version>${project.version}</version>
        </dependency>
      </dependencies>
    </profile>
    <profile>
      <id>aem65</id>
      <activation>
        <activeByDefault>false</activeByDefault>
      </activation>
      <properties>
        <cfg.context>aem65</cfg.context>
      </properties>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.jackrabbit</groupId>
            <artifactId>filevault-package-maven-plugin</artifactId>
            <configuration>
              <embeddeds>
                <embedded>
                  <groupId>com.adobe.aio.aem</groupId>
                  <artifactId>aio-aem-core</artifactId>
                  <classifier>aem65</classifier>
                  <target>/apps/aio-aem-events/install</target>
                </embedded>
                <embedded>
                  <groupId>com.adobe.aio.aem</groupId>
                  <artifactId>aio-lib-osgi</artifactId>
                  <classifier>aem65</classifier>
                  <target>/apps/aio-aem-events/install</target>
                </embedded>
                <embedded>
                  <groupId>com.adobe.aio.aem</groupId>
                  <artifactId>aio-aem-events-mgmt</artifactId>
                  <classifier>aem65</classifier>
                  <target>/apps/aio-aem-events/install</target>
                </embedded>
                <embedded>
                  <groupId>com.adobe.aio.aem</groupId>
                  <artifactId>aio-aem-events-publish</artifactId>
                  <classifier>aem65</classifier>
                  <target>/apps/aio-aem-events/install</target>
                </embedded>
                <embedded>
                  <groupId>com.adobe.aio.aem</groupId>
                  <artifactId>aio-aem-events-osgi-mapping</artifactId>
                  <classifier>aem65</classifier>
                  <target>/apps/aio-aem-events/install</target>
                </embedded>
              </embeddeds>
            </configuration>
          </plugin>
        </plugins>
      </build>
      <dependencies>
        <dependency>
          <groupId>com.adobe.aio.aem</groupId>
          <artifactId>aio-aem-events-osgi-mapping</artifactId>
          <version>${project.version}</version>
          <classifier>aem65</classifier>
        </dependency>
        <dependency>
          <groupId>com.adobe.aio.aem</groupId>
          <artifactId>aio-aem-events-publish</artifactId>
          <version>${project.version}</version>
          <classifier>aem65</classifier>
        </dependency>
        <dependency>
          <groupId>com.adobe.aio.aem</groupId>
          <artifactId>aio-aem-events-mgmt</artifactId>
          <version>${project.version}</version>
          <classifier>aem65</classifier>
        </dependency>
        <dependency>
          <groupId>com.adobe.aio.aem</groupId>
          <artifactId>aio-aem-core</artifactId>
          <version>${project.version}</version>
          <classifier>aem65</classifier>
        </dependency>
        <dependency>
          <groupId>com.adobe.aio.aem</groupId>
          <artifactId>aio-lib-osgi</artifactId>
          <version>${project.version}</version>
          <classifier>aem65</classifier>
        </dependency>
      </dependencies>

    </profile>
  </profiles>

  <scm>
    <tag>aio-lib-java-1.0.2</tag>
  </scm>
</project>
