<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~      Copyright (C) 2020  Kestros, Inc.
  ~
  ~     This program is free software: you can redistribute it and/or modify
  ~     it under the terms of the GNU General Public License as published by
  ~     the Free Software Foundation, either version 3 of the License, or
  ~     (at your option) any later version.
  ~
  ~     This program is distributed in the hope that it will be useful,
  ~     but WITHOUT ANY WARRANTY; without even the implied warranty of
  ~     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  ~     GNU General Public License for more details.
  ~
  ~     You should have received a copy of the GNU General Public License
  ~     along with this program.  If not, see <https://www.gnu.org/licenses/>.
  ~
  -->

<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/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>io.kestros.cms</groupId>
    <artifactId>kestros-basic-components</artifactId>
    <version>0.0.1</version>
  </parent>

  <groupId>io.kestros.cms</groupId>
  <artifactId>kestros-basic-components-frontend</artifactId>

  <name>Kestros Basic Components - Frontend Package</name>
  <packaging>content-package</packaging>
  
  <build>
    <resources>
      <resource>
        <directory>src/content/jcr_root</directory>
      </resource>
    </resources>

    <plugins>
      <!-- Builds the content package -->
      <plugin>
        <groupId>org.apache.jackrabbit</groupId>
        <artifactId>filevault-package-maven-plugin</artifactId>
        <version>1.0.3</version>
        <extensions>true</extensions>
        <executions>
          <execution>
            <goals>
              <goal>generate-metadata</goal>
              <goal>package</goal>
              <goal>analyze-classes</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <packageType>mixed</packageType>
          <failOnMissingEmbed>true</failOnMissingEmbed>
          <accessControlHandling>merge</accessControlHandling>
          <allowIndexDefinitions>true</allowIndexDefinitions>
          <filterSource>${basedir}/src/content/META-INF/vault/filter.xml</filterSource>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.sling</groupId>
        <artifactId>htl-maven-plugin</artifactId>
        <version>1.2.2-1.4.0</version>
        <configuration>
          <failOnWarnings>true</failOnWarnings>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>installPackage</id>
      <build>
        <plugins>
          <plugin>
            <groupId>io.wcm.maven.plugins</groupId>
            <artifactId>wcmio-content-package-maven-plugin</artifactId>
            <executions>
              <execution>
                <goals>
                  <goal>install</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <serviceURL>
                ${sling.protocol}://${sling.host}:${sling.port}/bin/cpm/package.service.html
              </serviceURL>
              <userId>${sling.username}</userId>
              <password>${sling.password}</password>
              <packageFile>target/${project.artifactId}-${project.version}.zip</packageFile>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

</project>
