<?xml version="1.0" encoding="UTF-8"?><!--
  ~ Copyright 2015-2018 _floragunn_ GmbH
  ~ 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.
  -->

<!--
  ~ Portions Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License").
  ~ You may not use this file except in compliance with the License.
  ~ A copy of the License is located at
  ~
  ~ http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ or in the "license" file accompanying this file. This file 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="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>com.amazon.opendistroforelasticsearch</groupId>
    <artifactId>opendistro_security_parent</artifactId>
    <version>1.0.0.2</version>
  </parent>

  <artifactId>opendistro_security</artifactId>
  <packaging>jar</packaging>
  <version>1.0.0.2</version>
  <name>Open Distro Security for Elasticsearch</name>
  <description>Open Distro For Elasticsearch Security</description>
  <inceptionYear>2015</inceptionYear>
  <licenses>
    <license>
      <name>The Apache Software License, Version 2.0</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
      <distribution>repo</distribution>
    </license>
  </licenses>

  <properties>
    <opendistro_security_advanceda_modules.version>1.0.0.2</opendistro_security_advanceda_modules.version>
    <elasticsearch.version>7.0.1</elasticsearch.version>

    <!-- deps -->
    <netty-native.version>2.0.20.Final</netty-native.version>
    <bc.version>1.61</bc.version>
    <log4j.version>2.11.1</log4j.version>
    <guava.version>25.1-jre</guava.version>
    <commons.cli.version>1.3.1</commons.cli.version>
    <jackson-databind.version>2.9.9.1</jackson-databind.version>
    
    <!-- assembly descriptors -->
    <elasticsearch.assembly.descriptor>${basedir}/src/main/assemblies/plugin.xml</elasticsearch.assembly.descriptor>
    <securitystandalone.descriptor>${basedir}/src/main/assemblies/securityadmin-standalone.xml</securitystandalone.descriptor>
    <veracode.descriptor>${basedir}/src/main/assemblies/veracode.xml</veracode.descriptor>
    
    <!-- Test only -->
    <mockito.version>2.23.0</mockito.version>
  </properties>

  <scm>
    <url>https://github.com/opendistro-for-elasticsearch/security</url>
    <connection>scm:git:git@github.com:opendistro-for-elasticsearch/security.git</connection>
    <developerConnection>scm:git:git@github.com:opendistro-for-elasticsearch/security.git</developerConnection>
    <tag>v1.0.0.2</tag>
  </scm>

  <issueManagement>
    <system>GitHub</system>
    <url>https://github.com/opendistro-for-elasticsearch/security/issues</url>
  </issueManagement>

    <dependencies>

        <!-- Netty 4 transport -->
        <dependency>
            <groupId>org.elasticsearch.plugin</groupId>
            <artifactId>transport-netty4-client</artifactId>
            <version>${elasticsearch.version}</version>
            <exclusions>
                <exclusion>
                    <artifactId>jna</artifactId>
                    <groupId>org.elasticsearch</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>jts</artifactId>
                    <groupId>com.vividsolutions</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>log4j-api</artifactId>
                    <groupId>org.apache.logging.log4j</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>spatial4j</artifactId>
                    <groupId>org.locationtech.spatial4j</groupId>
                </exclusion>
            </exclusions>
        </dependency>

        <!-- Guava -->
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>${guava.version}</version>
        </dependency>

        <!-- Apache commons cli -->
        <dependency>
            <groupId>commons-cli</groupId>
            <artifactId>commons-cli</artifactId>
            <version>${commons.cli.version}</version>
        </dependency>

        <!-- Bouncycastle -->
        <dependency>
            <groupId>org.bouncycastle</groupId>
            <artifactId>bcpg-jdk15on</artifactId>
            <version>${bc.version}</version>
        </dependency>

        <!-- provided scoped deps -->
        <dependency>
            <groupId>org.elasticsearch</groupId>
            <artifactId>elasticsearch</artifactId>
            <version>${elasticsearch.version}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
            <version>${log4j.version}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>${jackson-databind.version}</version>
            <exclusions>
                <exclusion>
                    <artifactId>jackson-core</artifactId>
                    <groupId>com.fasterxml.jackson.core</groupId>
                </exclusion>
            </exclusions>
        </dependency>


        <!-- Only test scoped dependencies hereafter -->
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-all</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.elasticsearch.plugin</groupId>
            <artifactId>reindex-client</artifactId>
            <version>${elasticsearch.version}</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.elasticsearch</groupId>
                    <artifactId>elasticsearch-ssl-config</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.apache.httpcomponents</groupId>
                    <artifactId>httpclient</artifactId>
                </exclusion>

            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>4.5.3</version>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.httpcomponents</groupId>
                    <artifactId>httpcore</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.elasticsearch</groupId>
            <artifactId>elasticsearch-ssl-config</artifactId>
            <version>${elasticsearch.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.elasticsearch.plugin</groupId>
            <artifactId>percolator-client</artifactId>
            <version>${elasticsearch.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.elasticsearch.plugin</groupId>
            <artifactId>lang-mustache-client</artifactId>
            <version>${elasticsearch.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.elasticsearch.plugin</groupId>
            <artifactId>parent-join-client</artifactId>
            <version>${elasticsearch.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.elasticsearch.plugin</groupId>
            <artifactId>aggs-matrix-stats-client</artifactId>
            <version>${elasticsearch.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <version>${mockito.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>

                <configuration>
                    <argLine>-Xmx3072m</argLine>
                    <rerunFailingTestsCount>3</rerunFailingTestsCount>
                    <forkCount>3</forkCount>
                    <reuseForks>true</reuseForks>
                    <!--
                    <parallel>methods</parallel>
                    <threadCount>1</threadCount>
                     -->
                    <systemPropertyVariables>
                        <forkno>fork_${surefire.forkNumber}</forkno>
                    </systemPropertyVariables>

                    <includes>
                        <include>**/*.java</include>
                    </includes>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <profiles>
        <profile>
            <id>advanced</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-assembly-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>plugin</id>
                                <phase>package</phase>
                                <configuration>
                                    <appendAssemblyId>false</appendAssemblyId>
                                    <tarLongFileMode>posix</tarLongFileMode>
                                    <outputDirectory>${project.build.directory}/releases/</outputDirectory>
                                    <descriptors>
                                        <descriptor>${elasticsearch.assembly.descriptor}</descriptor>
                                    </descriptors>
                                </configuration>
                                <goals>
                                    <goal>single</goal>
                                </goals>
                            </execution>
                            <execution>
                                <id>securityadmin</id>
                                <phase>package</phase>
                                <configuration>
                                    <appendAssemblyId>true</appendAssemblyId>
                                    <tarLongFileMode>posix</tarLongFileMode>
                                    <outputDirectory>${project.build.directory}/releases/</outputDirectory>
                                    <descriptors>
                                        <descriptor>${securitystandalone.descriptor}</descriptor>
                                    </descriptors>
                                </configuration>
                                <goals>
                                    <goal>single</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>com.floragunn</groupId>
                        <artifactId>checksum-maven-plugin</artifactId>
                        <version>1.7.1</version>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>files</goal>
                                </goals>
                                <phase>package</phase>
                            </execution>
                        </executions>
                        <configuration>
                            <fileSets>
                                <fileSet>
                                    <directory>${project.build.directory}/releases/</directory>
                                    <includes>
                                        <include>*.zip</include>
                                    </includes>
                                    <excludes>
                                        <exclude>*sgadmin*</exclude>
                                    </excludes>
                                </fileSet>
                            </fileSets>
                            <algorithms>
                                <algorithm>SHA-512</algorithm>
                            </algorithms>
                            <individualFiles>true</individualFiles>
                            <appendFilename>true</appendFilename>
                            <attachChecksums>true</attachChecksums>
                            <csvSummary>false</csvSummary>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
            <dependencies>
                <dependency>
                    <groupId>com.amazon.opendistroforelasticsearch</groupId>
                    <artifactId>opendistro_security_advanced_modules</artifactId>
                    <version>1.0.0.2</version>
                    <exclusions>
                        <exclusion>
                            <artifactId>jna</artifactId>
                            <groupId>org.elasticsearch</groupId>
                        </exclusion>
                        <exclusion>
                            <artifactId>jts</artifactId>
                            <groupId>com.vividsolutions</groupId>
                        </exclusion>
                        <exclusion>
                            <artifactId>log4j-api</artifactId>
                            <groupId>org.apache.logging.log4j</groupId>
                        </exclusion>
                        <exclusion>
                            <artifactId>spatial4j</artifactId>
                            <groupId>org.locationtech.spatial4j</groupId>
                        </exclusion>
                    </exclusions>
                </dependency>
                <dependency>
                    <groupId>org.elasticsearch.plugin</groupId>
                    <artifactId>lang-mustache-client</artifactId>
                    <version>${elasticsearch.version}</version>
                </dependency>

                <dependency>
                    <groupId>org.elasticsearch.plugin</groupId>
                    <artifactId>parent-join-client</artifactId>
                    <version>${elasticsearch.version}</version>
                </dependency>

                <dependency>
                    <groupId>org.elasticsearch.plugin</groupId>
                    <artifactId>aggs-matrix-stats-client</artifactId>
                    <version>${elasticsearch.version}</version>
                </dependency>
            </dependencies>
        </profile>
        <profile>
            <id>veracode</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-assembly-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>veracode</id>
                                <phase>package</phase>
                                <configuration>
                                    <appendAssemblyId>true</appendAssemblyId>
                                    <tarLongFileMode>posix</tarLongFileMode>
                                    <outputDirectory>${project.build.directory}/veracode/</outputDirectory>
                                    <descriptors>
                                        <descriptor>${veracode.descriptor}</descriptor>
                                    </descriptors>
                                </configuration>
                                <goals>
                                    <goal>single</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
            <dependencies>
                <dependency>
                    <groupId>com.amazon.opendistroforelasticsearch</groupId>
                    <artifactId>opendistro_security_advanced_modules</artifactId>
                    <version>${opendistro_security_advanceda_modules.version}</version>
                </dependency>
                <!-- omit  netty-tcnative and conscrypt-openjdk-uber if scan
                     should be done without natives -->
                <dependency>
                    <groupId>io.netty</groupId>
                    <artifactId>netty-tcnative</artifactId>
                    <version>${netty-native.version}</version>
                    <classifier>linux-x86_64</classifier>
                </dependency>
                <dependency>
                    <groupId>org.conscrypt</groupId>
                    <artifactId>conscrypt-openjdk-uber</artifactId>
                    <version>1.0.0.RC9</version>
                </dependency>
            </dependencies>
        </profile>
        <profile>
            <id>with-static-openssl-linux-non-fedora</id>
            <dependencies>
                <dependency>
                    <groupId>com.floragunn</groupId>
                    <artifactId>search-guard-static-tcnative-beta</artifactId>
                    <version>1.1.1a-${netty-native.version}-non-fedora-linux-x86_64</version>
                    <scope>provided</scope>
                </dependency>
            </dependencies>
        </profile>
        <profile>
            <id>with-static-openssl-linux-fedora</id>
            <dependencies>
                <dependency>
                    <groupId>com.floragunn</groupId>
                    <artifactId>search-guard-static-tcnative-beta</artifactId>
                    <version>1.1.1a-${netty-native.version}-fedora-linux-x86_64</version>
                    <scope>provided</scope>
                </dependency>
            </dependencies>
        </profile>
        <profile>
            <id>with-dynamic-openssl</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <dependencies>
                <dependency>
                    <groupId>io.netty</groupId>
                    <artifactId>netty-tcnative</artifactId>
                    <version>${netty-native.version}</version>
                    <classifier>${os.detected.classifier}</classifier>
                    <scope>provided</scope>
                </dependency>
            </dependencies>
        </profile>
    </profiles>
</project>
