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

    <modelVersion>4.0.0</modelVersion>
    <groupId>com.adobe.commerce.cif</groupId>
    <artifactId>cif-connector-parent</artifactId>
    <packaging>pom</packaging>
    <version>0.1.2</version>

    <name>CIF Connector - Parent project</name>
    <description>Parent project for the CIF connector</description>
    <url>https://github.com/adobe/commerce-cif-connector</url>

    <scm>
        <connection>scm:git:https://github.com/adobe/commerce-cif-connector.git</connection>
        <developerConnection>scm:git:git@github.com:adobe/commerce-cif-connector.git</developerConnection>
        <url>https://github.com/adobe/commerce-cif-connector</url>
        <tag>cif-connector-parent-0.1.2</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>

    <properties>
        <aem.host>localhost</aem.host>
        <aem.port>4502</aem.port>
        <aem.contextPath />
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <jacoco.data.file>${project.build.directory}/jacoco.exec</jacoco.data.file>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
            </plugin>
            
            <plugin>
                <groupId>org.sonatype.plugins</groupId>
                <artifactId>nexus-staging-maven-plugin</artifactId>
            </plugin>
            
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-deploy-plugin</artifactId>
            </plugin>
        </plugins>
    
        <pluginManagement>
            <plugins>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-release-plugin</artifactId>
                    <version>2.3.2</version>
                    <dependencies>
                        <dependency>
                            <groupId>org.apache.maven.release</groupId>
                            <artifactId>maven-release-oddeven-policy</artifactId>
                            <version>2.5.1</version>
                        </dependency>
                        <dependency>
                            <groupId>org.apache.maven.scm</groupId>
                            <artifactId>maven-scm-provider-gitexe</artifactId>
                            <version>1.9.1</version>
                        </dependency>
                    </dependencies>
                    <configuration>
                        <scmCommentPrefix>@releng [maven-scm] :</scmCommentPrefix>
                        <preparationGoals>clean install</preparationGoals>
                        <goals>deploy</goals>
                        <projectVersionPolicyId>OddEvenVersionPolicy</projectVersionPolicyId>
                        <autoVersionSubmodules>false</autoVersionSubmodules>
                        <pushChanges>false</pushChanges>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>org.sonatype.plugins</groupId>
                    <artifactId>nexus-staging-maven-plugin</artifactId>
                    <version>1.6.7</version>
                    <extensions>true</extensions>
                    <configuration>
                        <serverId>ossrh</serverId>
                        <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                        <autoReleaseAfterClose>true</autoReleaseAfterClose>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>2.4</version>
                    <executions>
                        <execution>
                            <id>attach-sources</id>
                            <goals>
                                <goal>jar-no-fork</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>3.0.1</version>
                    <executions>
                        <execution>
                            <id>attach-javadocs</id>
                            <goals>
                                <goal>jar</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <encoding>${project.build.sourceEncoding}</encoding>
                        <!-- Fixes JavaDoc build error with Java 11 -->
                        <source>8</source>
                        <quiet>true</quiet>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>2.8.2</version>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.1</version>
                    <configuration>
                        <source>1.8</source>
                        <target>1.8</target>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>com.day.jcr.vault</groupId>
                    <artifactId>content-package-maven-plugin</artifactId>
                    <version>0.5.24</version>
                </plugin>

                <plugin>
                    <groupId>org.apache.felix</groupId>
                    <artifactId>maven-bundle-plugin</artifactId>
                    <version>3.3.0</version>
                </plugin>

                <plugin>
                    <groupId>org.apache.rat</groupId>
                    <artifactId>apache-rat-plugin</artifactId>
                    <version>0.12</version>
                    <configuration>
                        <addDefaultLicenseMatchers>true</addDefaultLicenseMatchers>
                        <excludes>
                            <exclude>target/*</exclude>
                        </excludes>
                    </configuration>
                    <executions>
                        <execution>
                            <phase>compile</phase>
                            <goals>
                                <goal>check</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

                <plugin>
                    <groupId>org.apache.sling</groupId>
                    <artifactId>maven-sling-plugin</artifactId>
                    <version>2.1.10</version>
                </plugin>

                <plugin>
                    <groupId>org.apache.sling</groupId>
                    <artifactId>htl-maven-plugin</artifactId>
                    <version>1.0.2</version>
                    <configuration>
                        <sourceDirectory>src/main/content/jcr_root</sourceDirectory>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>2.7</version>
                    <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>
                
                <plugin>
                    <groupId>org.jacoco</groupId>
                    <artifactId>jacoco-maven-plugin</artifactId>
                    <version>0.8.3</version>
                    <executions>
                        <execution>
                            <id>default-instrument</id>
                            <goals>
                                <goal>instrument</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>default-restore-instrumented-classes</id>
                            <goals>
                                <goal>restore-instrumented-classes</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>check-coverage</id>
                            <goals>
                                <goal>check</goal>
                            </goals>
                            <configuration>
                                <haltOnFailure>true</haltOnFailure>
                                <dataFile>${jacoco.data.file}</dataFile>
                                <rules>
                                    <rule>
                                        <element>BUNDLE</element>
                                        <limits>
                                            <limit>
                                                <counter>INSTRUCTION</counter>
                                                <value>COVEREDRATIO</value>
                                                <minimum>0.0</minimum>
                                            </limit>
                                        </limits>
                                    </rule>
                                    <rule>
                                        <element>CLASS</element>
                                        <limits>
                                            <limit>
                                                <counter>INSTRUCTION</counter>
                                                <value>COVEREDRATIO</value>
                                                <minimum>0.0</minimum>
                                            </limit>
                                        </limits>
                                    </rule>
                                </rules>
                            </configuration>
                        </execution>
                        <execution>
                            <id>report</id>
                            <phase>prepare-package</phase>
                            <goals>
                                <goal>report</goal>
                            </goals>
                            <configuration>
                                <dataFile>${jacoco.data.file}</dataFile>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.18.1</version>
                    <configuration>
                        <useSystemClassLoader>false</useSystemClassLoader> <!-- Required for CircleCI -->
                        <systemPropertyVariables>
                            <jacoco-agent.destfile>${jacoco.data.file}</jacoco-agent.destfile>
                        </systemPropertyVariables>
                    </configuration>
                </plugin>

            </plugins>
        </pluginManagement>
    </build>

    <dependencyManagement>
        <dependencies>

            <!-- OSGi Dependencies -->
            <dependency>
                <groupId>org.osgi</groupId>
                <artifactId>org.osgi.core</artifactId>
                <version>6.0.0</version>
                <scope>provided</scope>
            </dependency>

            <dependency>
                <groupId>org.osgi</groupId>
                <artifactId>osgi.cmpn</artifactId>
                <version>6.0.0</version>
                <scope>provided</scope>
            </dependency>

            <!-- Javax annotations -->
            <dependency>
                <groupId>org.apache.sling</groupId>
                <artifactId>org.apache.sling.jcr.jcr-wrapper</artifactId>
                <version>2.0.0</version>
                <scope>provided</scope>
            </dependency>

            <dependency>
                <groupId>org.apache.felix</groupId>
                <artifactId>org.apache.felix.http.servlet-api</artifactId>
                <version>1.1.2</version>
                <scope>provided</scope>
            </dependency>

            <!-- AEM Uber JAR -->
            <dependency>
                <groupId>com.adobe.aem</groupId>
                <artifactId>uber-jar</artifactId>
                <version>6.4.4</version>
                <classifier>apis</classifier>
                <scope>provided</scope>
            </dependency>

            <!-- Testing -->
            <dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <version>4.12</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-simple</artifactId>
                <version>1.7.25</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.mockito</groupId>
                <artifactId>mockito-core</artifactId>
                <version>1.10.19</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.apache.sling</groupId>
                <artifactId>org.apache.sling.testing.sling-mock</artifactId>
                <version>2.2.12</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.jacoco</groupId>
                <artifactId>org.jacoco.agent</artifactId>
                <version>0.8.3</version>
                <classifier>runtime</classifier>
                <scope>test</scope>
            </dependency>

        </dependencies>
    </dependencyManagement>

    <profiles>
        <!-- GPG Signature on release -->
        <profile>
            <id>release-sign-artifacts</id>
            <activation>
                <property>
                    <name>performRelease</name>
                    <value>true</value>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>1.6</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                                <configuration>
                                    <gpgArguments>
                                        <arg>--pinentry-mode</arg>
                                        <arg>loopback</arg>
                                    </gpgArguments>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <repositories>
        <repository>
            <id>adobe-public-releases</id>
            <name>Adobe Public Repository</name>
            <url>https://repo.adobe.com/nexus/content/groups/public/</url>
            <layout>default</layout>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>adobe-public-releases</id>
            <name>Adobe Public Repository</name>
            <url>https://repo.adobe.com/nexus/content/groups/public/</url>
            <layout>default</layout>
        </pluginRepository>
    </pluginRepositories>

    <distributionManagement>
        <snapshotRepository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
        <repository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
    </distributionManagement>

    <developers>
        <developer>
            <name>Mark J. Becker</name>
            <email>mabecker@adobe.com</email>
            <organization>Adobe</organization>
            <organizationUrl>https://www.adobe.com</organizationUrl>
        </developer>
        <developer>
            <name>Markus Haack</name>
            <email>mhaack@adobe.com</email>
            <organization>Adobe</organization>
            <organizationUrl>https://www.adobe.com</organizationUrl>
        </developer>
        <developer>
            <name>Christophe Jelger</name>
            <email>jelger@adobe.com</email>
            <organization>Adobe</organization>
            <organizationUrl>https://www.adobe.com</organizationUrl>
        </developer>
        <developer>
            <name>Daniel Platon</name>
            <email>platon@adobe.com</email>
            <organization>Adobe</organization>
            <organizationUrl>https://www.adobe.com</organizationUrl>
        </developer>
        <developer>
            <name>Levente Santha</name>
            <email>sntha@adobe.com</email>
            <organization>Adobe</organization>
            <organizationUrl>https://www.adobe.com</organizationUrl>
        </developer>
    </developers>

</project>
