<?xml version="1.0" encoding="UTF-8"?>
<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>

    <groupId>be.dnsbelgium.data</groupId>
    <artifactId>pcap-to-athena</artifactId>
    <version>0.1</version>
    <packaging>jar</packaging>

    <name>PCAP to Athena</name>
    <description>Convert PCAP files to Parquet format and make them available via Amazon Athena.</description>
    <url>https://github.com/DNSBelgium/PCAP-to-Athena</url>

    <licenses>
        <license>
            <name>GNU General Public License (GPL), Version 3</name>
            <url>http://www.gnu.org/licenses/gpl-3.0.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <developers>
        <developer>
            <name>DNS Belgium Engineering</name>
            <email>engineeringd@dnsbelgium.be</email>
            <organization>DNS Belgium</organization>
            <organizationUrl>https://www.dnsbelgium.be</organizationUrl>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:git://github.com/DNSBelgium/PCAP-to-Athena.git</connection>
        <developerConnection>scm:git:ssh://git@github.com/DNSBelgium/PCAP-to-Athena.git</developerConnection>
        <url>https://github.com/DNSBelgium/PCAP-to-Athena</url>
      <tag>v0.1</tag>
  </scm>

    <issueManagement>
        <system>Github</system>
        <url>https://github.com/DNSBelgium/PCAP-to-Athena/issues</url>
    </issueManagement>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.6.RELEASE</version>
        <relativePath /> <!-- lookup parent from repository -->
    </parent>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
        <spring-cloud-version>2.0.0.RELEASE</spring-cloud-version>
    </properties>

    <dependencies>

        <!--============-->
        <!--  SPRING    -->
        <!--============-->

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-logging</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>

        <!--<dependency>-->
        <!--<groupId>org.springframework.boot</groupId>-->
        <!--<artifactId>spring-boot-starter-web</artifactId>-->
        <!--</dependency>-->

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jdbc</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.shell</groupId>
            <artifactId>spring-shell-starter</artifactId>
            <version>2.0.0.RELEASE</version>
        </dependency>

        <!--====================-->
        <!--  SPRING CLOUD      -->
        <!--====================-->

        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-aws-context</artifactId>
            <version>${spring-cloud-version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-aws-autoconfigure</artifactId>
            <version>${spring-cloud-version}</version>
        </dependency>


        <!-- AWS did not publish their jar in Maven repo -->
        <dependency>
            <groupId>com.simba.athena</groupId>
            <artifactId>jdbc42-driver</artifactId>
            <version>2.0.7</version>
        </dependency>

        <!--====================-->
        <!--    AWS             -->
        <!--====================-->

        <!-- https://mvnrepository.com/artifact/com.amazonaws/aws-java-sdk-s3 -->
        <dependency>
            <groupId>com.amazonaws</groupId>
            <artifactId>aws-java-sdk-s3</artifactId>
            <version>1.11.441</version>
        </dependency>

        <!--====================-->
        <!--    SERVLET         -->
        <!--====================-->

        <!--<dependency>-->
        <!--<groupId>javax.servlet</groupId>-->
        <!--<artifactId>javax.servlet-api</artifactId>-->
        <!--<version>3.1.0</version>-->
        <!--</dependency>-->

        <!--===============================-->
        <!--    JAVA Expression Language   -->
        <!--===============================-->

        <dependency>
            <groupId>javax.el</groupId>
            <artifactId>javax.el-api</artifactId>
            <version>3.0.0</version>
        </dependency>

        <dependency>
            <groupId>org.glassfish</groupId>
            <artifactId>javax.el</artifactId>
            <version>3.0.0</version>
        </dependency>


        <!--====================-->
        <!--  APACHE COMMONS    -->
        <!--====================-->

        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.4</version>
        </dependency>

        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.4</version>
        </dependency>

        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-compress</artifactId>
            <version>1.4.1</version>
        </dependency>

        <!--============-->
        <!--  guava     -->
        <!--============-->

        <!-- https://mvnrepository.com/artifact/com.google.guava/guava -->
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>27.0-jre</version>
        </dependency>

        <!--============-->
        <!--  ENTRADA    -->
        <!--============-->

        <dependency>
            <groupId>nl.sidn</groupId>
            <artifactId>dnslib</artifactId>
            <version>0.1.2</version>
        </dependency>

        <dependency>
            <groupId>nl.sidn</groupId>
            <artifactId>pcap-lib</artifactId>
            <version>0.1.2</version>
        </dependency>

        <!--============-->
        <!--  MaxMind   -->
        <!--============-->

        <dependency>
            <groupId>com.maxmind.geoip2</groupId>
            <artifactId>geoip2</artifactId>
            <version>2.11.0</version>
        </dependency>

        <!--============-->
        <!--  LOGGING   -->
        <!--============-->

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.7.25</version>
        </dependency>

        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.17</version>
        </dependency>

        <!--parquet-hadoop uses a 'Simple wrapper around java.util.logging' see class parquet.Log-->
        <!-- https://mvnrepository.com/artifact/org.slf4j/jul-to-slf4j -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jul-to-slf4j</artifactId>
            <version>1.7.25</version>
        </dependency>

        <!--============-->
        <!--  PARQUET   -->
        <!--============-->

        <dependency>
            <groupId>org.apache.parquet</groupId>
            <artifactId>parquet-common</artifactId>
            <version>1.10.0</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.apache.parquet/parquet-avro -->
        <!--OpsGenie uses 1.9.0-->
        <!--Entrada uses  com.twitter:parquet-avro:jar:1.4.1:compile-->
        <dependency>
            <groupId>org.apache.parquet</groupId>
            <artifactId>parquet-avro</artifactId>
            <version>1.10.0</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.apache.parquet/parquet-hadoop -->
        <!--OpsGenie uses 1.9.0-->
        <!--Entrada uses com.twitter:parquet-hadoop:jar:1.4.1:compile-->
        <dependency>
            <groupId>org.apache.parquet</groupId>
            <artifactId>parquet-hadoop</artifactId>
            <version>1.10.0</version>
        </dependency>

        <!-- Not explicitly needed: https://mvnrepository.com/artifact/org.apache.parquet/parquet-format -->

        <!--============-->
        <!--  KITE   -->
        <!--============-->

        <!--Entrada uses 1.0.0-->
        <!-- https://mvnrepository.com/artifact/org.kitesdk/kite-data-core -->
        <!-- adding this causes a java.lang.NoClassDefFoundError: org/apache/avro/LogicalType -->
        <!--unless we also add org.apache.avro:avro-->
        <dependency>
            <groupId>org.kitesdk</groupId>
            <artifactId>kite-data-core</artifactId>
            <version>1.0.0</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.kitesdk/kite-hadoop-dependencies -->
        <dependency>
            <groupId>org.kitesdk</groupId>
            <artifactId>kite-hadoop-dependencies</artifactId>
            <version>1.0.0</version>
            <type>pom</type>
        </dependency>


        <!--============-->
        <!--   KRYO     -->
        <!--============-->

        <!-- https://mvnrepository.com/artifact/com.esotericsoftware/kryo -->
        <dependency>
            <groupId>com.esotericsoftware</groupId>
            <artifactId>kryo</artifactId>
            <version>4.0.2</version>
        </dependency>


        <!--============-->
        <!--   AVRO     -->
        <!--============-->

        <!-- https://mvnrepository.com/artifact/org.apache.avro/avro -->
        <dependency>
            <groupId>org.apache.avro</groupId>
            <artifactId>avro</artifactId>
            <version>1.8.2</version>
        </dependency>

        <!--============-->
        <!--  HADOOP    -->
        <!--============-->

        <!--OpsGenie uses 2.7.3-->
        <!--Many versions exist. Latest in 2.7 is 2.7.7-->
        <!--Other: 2.8.5, 2.9.1, 3.1.1-->
        <!--Entrada uses 2.3.0 -->
        <dependency>
            <groupId>org.apache.hadoop</groupId>
            <artifactId>hadoop-common</artifactId>
            <version>2.7.3</version>
        </dependency>


        <!--============-->
        <!--  DNSJAVA   -->
        <!--============-->

        <dependency>
            <groupId>dnsjava</groupId>
            <artifactId>dnsjava</artifactId>
            <version>2.1.7</version>
        </dependency>

    </dependencies>

    <distributionManagement>
        <snapshotRepository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
    </distributionManagement>

    <build>
        <plugins>

            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>2.5.3</version>
                <configuration>
                    <tagNameFormat>v@{project.version}</tagNameFormat>
                    <autoVersionSubmodules>true</autoVersionSubmodules>
                    <releaseProfiles>release</releaseProfiles>
                </configuration>
            </plugin>

            <plugin>
                <groupId>com.google.cloud.tools</groupId>
                <artifactId>jib-maven-plugin</artifactId>
                <version>1.0.1</version>
                <configuration>
                    <from>
                        <!--by default distroless/java is used which does not include a shell-->
                        <!--But kite-sdk and/or hadoop call chmod and fail with 'Cannot run program "chmod": error=2, No such file or directory'-->
                        <!--Therefor we use java:debug which does include a shell-->
                        <image>gcr.io/distroless/java:debug</image>
                    </from>
                    <to>
                        <image>549063153765.dkr.ecr.eu-west-1.amazonaws.com/pcap-processor</image>
                    </to>
                    <container>
                        <mainClass>be.dnsbelgium.data.pcap.PcapToAthenaApplication</mainClass>
                    </container>
                </configuration>

            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-install-plugin</artifactId>
                <inherited>false</inherited>
                <executions>
                    <execution>
                        <id>install1</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>install-file</goal>
                        </goals>
                        <configuration>
                            <groupId>com.simba.athena</groupId>
                            <artifactId>jdbc42-driver</artifactId>
                            <version>2.0.7</version>
                            <packaging>jar</packaging>
                            <file>${basedir}/lib/AthenaJDBC42_2.0.7.jar</file>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

        </plugins>
    </build>

    <profiles>
        <!-- Activate using the release property: mvn clean install -Prelease -->
        <profile>
            <id>release</id>
            <activation>
                <property>
                    <name>release</name>
                </property>
            </activation>

            <build>
                <plugins>
                    <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-gpg-plugin</artifactId>
                        <version>1.5</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>2.2.1</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>2.9.1</version>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                </plugins>
            </build>
        </profile>
    </profiles>
</project>
