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

<!--
   /*
    *
    *  Copyright 2018 Expedia, Inc.
    *
    *     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:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
         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>

    <groupId>com.expedia.www</groupId>
    <artifactId>haystack-secrets-commons</artifactId>
    <version>1.0.2</version>
    <packaging>jar</packaging>

    <scm>
        <connection>scm:git:git://github.com/ExpediaDotCom/haystack-secrets-commons.git</connection>
        <developerConnection>scm:git:ssh://github.com/ExpediaDotCom/haystack-secrets-commons.git</developerConnection>
        <url>http://github.com/ExpediaDotCom/haystack-secrets-commons</url>
    </scm>

    <name>haystack-secrets-commons</name>
    <description>
        This module contains common code for Haystack modules that detect and mask PCI and PII data;
        it also contains code that facilitates writing Kafka Streams applications.
    </description>
    <url>https://github.com/ExpediaDotCom/haystack-secrets-commons/tree/master</url>

    <licenses>
        <!--
           /*
            *
            *  Copyright 2018 Expedia, Inc.
            *
            *     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.
            *
            */
          -->
        <license>
            <name>Apache License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <developers>
        <developer>
            <id>haystack</id>
            <name>Haystack Team</name>
            <email>haystack@expedia.com</email>
            <url>https://github.com/ExpediaDotCom/haystack</url>
        </developer>
    </developers>

    <properties>
        <!-- dependency properties -->
        <aws-java-sdk.version>1.11.397</aws-java-sdk.version>
        <cfg4j-core.version>4.4.1</cfg4j-core.version>
        <chlorine-finder.version>1.1.5</chlorine-finder.version>
        <grpc.version>1.7.0</grpc.version>
        <guava.version>19.0</guava.version>
        <haystack-metrics.version>2.0.1</haystack-metrics.version>
        <kafka.version>1.0.1</kafka.version>
        <libphonenumber.version>8.9.2</libphonenumber.version>
        <protobuf.version>3.3.1</protobuf.version>
        <servo.version>0.12.17</servo.version>
        <slf4j.version>1.7.25</slf4j.version>

        <!-- compiler properties -->
        <project.jdk.version>1.8</project.jdk.version>
        <scala.major.version>2</scala.major.version>
        <scala.minor.version>12</scala.minor.version>
        <scala.maintenance.version>2</scala.maintenance.version>
        <scala.major.minor.version>${scala.major.version}.${scala.minor.version}</scala.major.minor.version>
        <scala-library.version>${scala.major.minor.version}.${scala.maintenance.version}</scala-library.version>

        <!--test dependencies -->
        <junit-version>4.12</junit-version>
        <mockito-version>1.9.5</mockito-version>

        <!-- plugin properties -->
        <build-helper-maven-plugin.version>1.12</build-helper-maven-plugin.version>
        <jacoco-maven-plugin.version>0.8.0</jacoco-maven-plugin.version>
        <jacoco-percentage>1.0</jacoco-percentage>
        <maven-protobuf-plugin.version>3.3.0.1</maven-protobuf-plugin.version>
        <maven-compiler-plugin.version>3.6.1</maven-compiler-plugin.version>
        <maven-gpg-plugin.version>1.6</maven-gpg-plugin.version>
        <maven-javadoc-plugin.version>2.10.4</maven-javadoc-plugin.version>
        <maven-jar-plugin-version>3.0.2</maven-jar-plugin-version>
        <maven-source-plugin.version>3.0.1</maven-source-plugin.version>
        <nexus-staging-maven-plugin.version>1.6.8</nexus-staging-maven-plugin.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>com.amazonaws</groupId>
            <artifactId>aws-java-sdk-s3</artifactId>
            <version>${aws-java-sdk.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.expedia.www</groupId>
            <artifactId>haystack-metrics</artifactId>
            <version>${haystack-metrics.version}</version>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>${guava.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.google.protobuf</groupId>
            <artifactId>protobuf-java</artifactId>
            <version>${protobuf.version}</version>
        </dependency>
        <dependency>
            <groupId>com.googlecode.libphonenumber</groupId>
            <artifactId>libphonenumber</artifactId>
            <version>${libphonenumber.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.netflix.servo</groupId>
            <artifactId>servo-core</artifactId>
            <version>${servo.version}</version>
        </dependency>
        <dependency>
            <groupId>io.dataapps.chlorine</groupId>
            <artifactId>chlorine-finder</artifactId>
            <version>${chlorine-finder.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>io.grpc</groupId>
            <artifactId>grpc-protobuf</artifactId>
            <version>${grpc.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>io.grpc</groupId>
            <artifactId>grpc-stub</artifactId>
            <version>${grpc.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.kafka</groupId>
            <artifactId>kafka_${scala.major.minor.version}</artifactId>
            <version>${kafka.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.kafka</groupId>
            <artifactId>kafka-streams</artifactId>
            <version>${kafka.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.cfg4j</groupId>
            <artifactId>cfg4j-core</artifactId>
            <version>${cfg4j-core.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
            <version>${build-helper-maven-plugin.version}</version>
            <scope>provided</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-api</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-nop</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-jdk14</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>jcl-over-slf4j</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>${slf4j.version}</version>
        </dependency>

        <!-- test dependencies -->
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-all</artifactId>
            <version>${mockito-version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>${junit-version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <build>
        <resources>
            <resource>
                <directory>${basedir}/src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>${build-helper-maven-plugin.version}</version>
                <executions>
                    <execution>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>add-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>${basedir}/src/main/java</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>${project.jdk.version}</source>
                    <target>${project.jdk.version}</target>
                    <encoding>UTF-8</encoding>
                </configuration>
                <version>${maven-compiler-plugin.version}</version>
            </plugin>
            <plugin>
                <groupId>com.github.os72</groupId>
                <artifactId>protoc-jar-maven-plugin</artifactId>
                <version>${maven-protobuf-plugin.version}</version>
                <executions>
                    <execution>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <protocArtifact>com.google.protobuf:protoc:3.0.0</protocArtifact>
                            <includeDirectories>
                                <include>${project.basedir}/haystack-idl/proto</include>
                                <include>${project.basedir}/haystack-idl/proto/api</include>
                            </includeDirectories>
                            <inputDirectories>
                                <include>${project.basedir}/haystack-idl/proto</include>
                                <include>${project.basedir}/haystack-idl/proto/api</include>
                            </inputDirectories>
                            <outputDirectory>${project.basedir}/target/generated-sources</outputDirectory>
                            <outputTargets>
                                <outputTarget>
                                    <type>java</type>
                                </outputTarget>
                                <outputTarget>
                                    <type>grpc-java</type>
                                    <pluginArtifact>io.grpc:protoc-gen-grpc-java:1.0.1</pluginArtifact>
                                </outputTarget>
                            </outputTargets>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>${maven-source-plugin.version}</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>${maven-javadoc-plugin.version}</version>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
    	    <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>${maven-jar-plugin-version}</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-gpg-plugin</artifactId>
                <version>${maven-gpg-plugin.version}</version>
                <executions>
                    <execution>
                        <id>sign-artifacts</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>sign</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.sonatype.plugins</groupId>
                <artifactId>nexus-staging-maven-plugin</artifactId>
                <version>${nexus-staging-maven-plugin.version}</version>
                <extensions>true</extensions>
                <configuration>
                    <serverId>ossrh</serverId>
                    <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                    <autoReleaseAfterClose>true</autoReleaseAfterClose>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>${jacoco-maven-plugin.version}</version>
                <configuration>
                    <excludes>
                        <exclude>**/com/expedia/open/tracing/**</exclude>
                    </excludes>
                </configuration>
                <executions>
                    <execution>
                        <id>jacoco-initialize</id>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>jacoco-report</id>
                        <phase>test</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>jacoco-check</id>
                        <phase>test</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <rule>
                                    <element>BUNDLE</element>
                                    <limits>
                                        <limit>
                                            <counter>INSTRUCTION</counter>
                                            <value>COVEREDRATIO</value>
                                            <minimum>${jacoco-percentage}</minimum>
                                        </limit>
                                        <limit>
                                            <counter>BRANCH</counter>
                                            <value>COVEREDRATIO</value>
                                            <minimum>${jacoco-percentage}</minimum>
                                        </limit>
                                    </limits>
                                </rule>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

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

</project>
