<?xml version="1.0" encoding="UTF-8"?>
<!--
 Apache HTTPD & NGINX Access log parsing made easy
 Copyright (C) 2011-2019 Niels Basjes

 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

 https://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="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>nl.basjes.parse</groupId>
  <artifactId>parser-parent</artifactId>
  <version>5.2</version>
  <packaging>pom</packaging>
  <name>Parser -</name>
  <description>A library to allow easy parsing of Apache HTTPD access logs with Java, Hadoop and Pig.</description>
  <url>https://github.com/nielsbasjes/logparser</url>

  <properties>
    <jdkLevel>1.8</jdkLevel>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.build.outputEncoding>UTF-8</project.build.outputEncoding>

    <checkstyle-plugin.version>3.0.0</checkstyle-plugin.version>
    <checkstyle.version>8.16</checkstyle.version>

    <lombok.version>1.18.4</lombok.version>

    <hadoop.version>2.8.5</hadoop.version>
    <hive.version>2.3.4</hive.version>
    <pig.version>0.17.0</pig.version>
    <avro.version>1.8.2</avro.version>
    <beam.version>2.9.0</beam.version>
    <flink.version>1.7.1</flink.version>
    <flink.scala.version>2.11</flink.scala.version>
    <storm.version>1.2.2</storm.version>

    <rat.version>0.13</rat.version>
    <jacoco.version>0.8.2</jacoco.version>

    <!-- See http://www.eclemma.org/jacoco/trunk/doc/prepare-agent-mojo.html-->
    <jacoco.surefireArgLine/>
    <argLine>@{jacoco.surefireArgLine} -Xmx2048m</argLine>
  </properties>

  <dependencies>

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

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

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

    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-log4j12</artifactId>
      <version>1.7.21</version>
      <scope>test</scope>
    </dependency>

  </dependencies>

  <profiles>
    <profile>
      <id>release</id>
      <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>
              </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.10.4</version>
            <executions>
              <execution>
                <id>attach-javadocs</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>

          <plugin>
            <!-- explicitly define maven-deploy-plugin after other to force exec order -->
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-deploy-plugin</artifactId>
            <version>2.8.2</version>
            <executions>
              <execution>
                <id>deploy</id>
                <phase>deploy</phase>
                <goals>
                  <goal>deploy</goal>
                </goals>
              </execution>
            </executions>
          </plugin>

        </plugins>
      </build>
    </profile>

    <profile>
      <id>EnableReportPlugins</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
          </plugin>
          <plugin>
            <groupId>org.eluder.coveralls</groupId>
            <artifactId>coveralls-maven-plugin</artifactId>
            <version>4.3.0</version>
            <configuration>
              <relativeReportDirs>
                <relativeReportDir>/jacoco-ut</relativeReportDir>
                <!--<relativeReportDir>/jacoco-it</relativeReportDir>-->
              </relativeReportDirs>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

  </profiles>

  <build>
    <defaultGoal>clean package</defaultGoal>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-checkstyle-plugin</artifactId>
          <version>${checkstyle-plugin.version}</version>
          <dependencies>
            <dependency>
              <groupId>nl.basjes.parse.devtools</groupId>
              <artifactId>devtools</artifactId>
              <version>${project.version}</version>
            </dependency>
            <dependency>
              <groupId>com.puppycrawl.tools</groupId>
              <artifactId>checkstyle</artifactId>
              <version>${checkstyle.version}</version>
            </dependency>
          </dependencies>
          <configuration>
            <consoleOutput>true</consoleOutput>
            <configLocation>checkstyle/checkstyle.xml</configLocation>
            <suppressionsLocation>checkstyle/suppressions.xml</suppressionsLocation>
            <includeTestSourceDirectory>true</includeTestSourceDirectory>
          </configuration>
          <!-- Runs by default in the verify phase  (mvn verify or later in the build cycle)
               the 'check' goal will fail the build if it does not pass.  "mvn checkstyle:check"
               will do this alone, or "mvn checkstyle:checkstyle" will report but not break  -->
          <executions>
            <execution>
              <id>checkstyle-check</id>
              <phase>test</phase>
              <goals>
                <goal>check</goal>
              </goals>
            </execution>
          </executions>
        </plugin>

        <!-- Coverage analysis for tests -->
        <plugin>
          <groupId>org.jacoco</groupId>
          <artifactId>jacoco-maven-plugin</artifactId>
          <version>${jacoco.version}</version>
          <executions>
            <!--
                Prepares the property pointing to the JaCoCo runtime agent which
                is passed as VM argument when Maven the Surefire plugin is executed.
            -->
            <execution>
              <id>pre-unit-test</id>
              <goals>
                <goal>prepare-agent</goal>
              </goals>
              <configuration>
                <!-- Sets the path to the file which contains the execution data. -->
                <destFile>${project.build.directory}/coverage-reports/jacoco-ut.exec</destFile>
                <!--
                    Sets the name of the property containing the settings
                    for JaCoCo runtime agent.
                -->
                <propertyName>jacoco.surefireArgLine</propertyName>
              </configuration>
            </execution>
            <!--
                Ensures that the code coverage report for unit tests is created after
                unit tests have been run.
            -->
            <execution>
              <id>post-unit-test</id>
              <phase>test</phase>
              <goals>
                <goal>report</goal>
              </goals>
              <configuration>
                <!-- Sets the path to the file which contains the execution data. -->
                <dataFile>${project.build.directory}/coverage-reports/jacoco-ut.exec</dataFile>
                <!-- Sets the output directory for the code coverage report. -->
                <outputDirectory>${project.reporting.outputDirectory}/jacoco-ut</outputDirectory>
              </configuration>
            </execution>
          </executions>
        </plugin>

      </plugins>
    </pluginManagement>
    <plugins>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.19.1</version>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <version>1.4.1</version>
        <executions>
          <execution>
            <id>enforce-maven</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <requireMavenVersion>
                  <version>[3.1,)</version>
                  <message>You must use a newer version of Maven (the Maven 3.0.5 built in into IntelliJ IDEA is too old!)</message>
                </requireMavenVersion>
              </rules>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <!-- Description: https://github.com/ktoso/maven-git-commit-id-plugin -->
        <groupId>pl.project13.maven</groupId>
        <artifactId>git-commit-id-plugin</artifactId>
        <version>2.2.1</version>
        <executions>
          <execution>
            <id>get-the-git-infos</id>
            <phase>validate</phase>
            <goals>
              <goal>revision</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <dateFormat>yyyy-MM-dd '@' HH:mm:ss z</dateFormat>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.rat</groupId>
        <artifactId>apache-rat-plugin</artifactId>
        <version>${rat.version}</version>
        <inherited>false</inherited>
        <!-- https://issues.apache.org/jira/browse/RAT-158 -->
        <dependencies>
          <dependency>
            <groupId>org.apache.maven.doxia</groupId>
            <artifactId>doxia-core</artifactId>
            <version>1.6</version>
            <exclusions>
              <exclusion>
                <groupId>xerces</groupId>
                <artifactId>xercesImpl</artifactId>
              </exclusion>
            </exclusions>
          </dependency>
        </dependencies>
        <executions>
          <execution>
            <phase>test</phase>
            <goals>
              <goal>check</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <consoleOutput>true</consoleOutput>
          <excludeSubProjects>false</excludeSubProjects>
          <excludes>
            <!-- Version control files -->
            <exclude>**/.git/**</exclude>
            <exclude>**/.gitignore</exclude>
            <!-- IDE settings and files -->
            <exclude>**/.classpath</exclude>
            <exclude>**/.project</exclude>
            <exclude>**/.settings/**</exclude>
            <exclude>**/.idea/**</exclude>
            <exclude>**/*.iml</exclude>
            <!-- Test and demo input files -->
            <exclude>**/src/test/resources/*.log</exclude>
            <exclude>**/demolog/*.log</exclude>
            <exclude>GeoIP2-TestData/**</exclude>
            <!-- File generated during build -->
            <exclude>**/target/**</exclude>
            <exclude>**/dependency-reduced-pom.xml</exclude>
            <exclude>docker/_m2/**</exclude>
          </excludes>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.5.1</version>
        <configuration>
          <source>${jdkLevel}</source>
          <target>${jdkLevel}</target>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
        <version>3.0.0</version>
      </plugin>

    </plugins>
  </build>

  <modules>
    <module>devtools</module>
    <module>parser-core</module>
    <module>httpdlog</module>
    <module>examples</module>
    <module>utils</module>
  </modules>

  <licenses>
    <license>
      <name>Apache License, Version 2.0</name>
      <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
      <distribution>repo</distribution>
    </license>
  </licenses>

  <developers>
    <developer>
      <name>Niels Basjes</name>
      <email>niels@basjes.nl</email>
      <roles>
        <role>Architect</role>
        <role>Developer</role>
      </roles>
      <timezone>Europe/Amsterdam</timezone>
    </developer>
  </developers>

  <scm>
    <developerConnection>scm:git:.</developerConnection>
    <connection>scm:https://github.com/nielsbasjes/logparser.git</connection>
    <url>https://github.com/nielsbasjes/logparser</url>
  </scm>

</project>
