<?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>com.github.daggerok</groupId>
  <artifactId><%= projectDirectory %></artifactId>
  <version>0.0.1</version>
  <packaging>war</packaging>

  <properties>
    <java.version>1.8</java.version>
    <maven.compiler.source>${java.version}</maven.compiler.source>
    <maven.compiler.target>${java.version}</maven.compiler.target>
    <encoding>UTF-8</encoding>
    <archetype.encoding>${encoding}</archetype.encoding>
    <project.build.sourceEncoding>${encoding}</project.build.sourceEncoding>
    <project.reporting.outputEncoding>${encoding}</project.reporting.outputEncoding>
    <project.resources.outputEncoding>${encoding}</project.resources.outputEncoding>
    <material.design.icons.version>3.0.1</material.design.icons.version>
    <hibernate.core.version>4.2.18.Final</hibernate.core.version>
    <materializecss.version>1.0.0</materializecss.version>
    <junit.jupiter.version>5.3.1</junit.jupiter.version>
    <assertj.version>3.11.1</assertj.version>
    <ozark.version>1.0.0-m03</ozark.version>
    <assertk.version>0.12</assertk.version>
    <lombok.version>1.18.6</lombok.version>
    <jgiven.version>0.16.1</jgiven.version>
    <junit4.version>4.12</junit4.version>
    <slf4j.version>1.7.25</slf4j.version>
    <javaee.version>8.0</javaee.version>
    <vavr.version>0.9.2</vavr.version>
    <h2.version>1.4.196</h2.version>
  </properties>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.junit</groupId>
        <artifactId>junit-bom</artifactId>
        <version>${junit.jupiter.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <repositories>
    <repository>
      <id>jcenter.bintray.com</id>
      <url>https://jcenter.bintray.com</url>
    </repository>
  </repositories>

  <dependencies>
    <!-- MVC 1.0 @Controller -->
    <dependency>
      <groupId>javax.mvc</groupId>
      <artifactId>javax.mvc-api</artifactId>
      <version>1.0-pr</version>
    </dependency>

    <!-- Thymeleaf -->
    <dependency>
      <groupId>org.mvc-spec.ozark</groupId>
      <artifactId>ozark-resteasy</artifactId>
      <version>${ozark.version}</version>
    </dependency>
    <dependency>
      <groupId>org.mvc-spec.ozark.ext</groupId>
      <artifactId>ozark-thymeleaf</artifactId>
      <version>${ozark.version}</version>
      <exclusions>
        <exclusion>
          <groupId>org.thymeleaf</groupId>
          <artifactId>thymeleaf</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.thymeleaf</groupId>
      <artifactId>thymeleaf</artifactId>
      <version>3.0.9.RELEASE</version>
    </dependency>
    <dependency>
      <groupId>org.thymeleaf.extras</groupId>
      <artifactId>thymeleaf-extras-java8time</artifactId>
      <version>3.0.1.RELEASE</version>
    </dependency>
    <dependency>
      <groupId>org.thymeleaf</groupId>
      <artifactId>thymeleaf-testing</artifactId>
      <version>3.0.3.RELEASE</version>
      <scope>test</scope>
    </dependency>
    <!--
    <dependency>
      <groupId>org.thymeleaf.extras</groupId>
      <artifactId>thymeleaf-extras-tiles2</artifactId>
      <version>2.1.1.RELEASE</version>
    </dependency>
    <dependency>
      <groupId>org.thymeleaf.extras</groupId>
      <artifactId>thymeleaf-extras-conditionalcomments</artifactId>
      <version>2.1.4.RELEASE</version>
    </dependency>
    -->

    <dependency>
      <groupId>org.webjars</groupId>
      <artifactId>material-design-icons</artifactId>
      <version>${material.design.icons.version}</version>
    </dependency>
    <dependency>
      <groupId>org.webjars</groupId>
      <artifactId>materializecss</artifactId>
      <version>${materializecss.version}</version>
    </dependency>

    <dependency>
      <groupId>javax</groupId>
      <artifactId>javaee-api</artifactId>
      <version>${javaee.version}</version>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>com.h2database</groupId>
      <artifactId>h2</artifactId>
      <version>${h2.version}</version>
      <type>jar</type>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>io.vavr</groupId>
      <artifactId>vavr</artifactId>
      <version>${vavr.version}</version>
    </dependency>

    <dependency>
      <groupId>org.projectlombok</groupId>
      <artifactId>lombok</artifactId>
      <version>${lombok.version}</version>
      <optional>true</optional>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <version>${slf4j.version}</version>
    </dependency>

    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-jdk14</artifactId>
      <version>${slf4j.version}</version>
    </dependency>

    <dependency>
      <groupId>org.jboss.resteasy</groupId>
      <artifactId>resteasy-json-p-provider</artifactId>
      <version>3.0.7.Final</version>
    </dependency>

    <!-- JSON -->
    <dependency>
      <groupId>javax.json</groupId>
      <artifactId>javax.json-api</artifactId>
      <version>1.0</version>
    </dependency>
    <dependency>
      <groupId>org.glassfish</groupId>
      <artifactId>javax.json</artifactId>
      <version>1.0.4</version>
    </dependency>

    <!-- Hibernate UUID -->
    <dependency>
      <groupId>org.hibernate</groupId>
      <artifactId>hibernate-core</artifactId>
      <version>${hibernate.core.version}</version>
    </dependency>

    <!-- assertj -->
    <dependency>
      <groupId>org.assertj</groupId>
      <artifactId>assertj-core</artifactId>
      <version>${assertj.version}</version>
      <scope>test</scope>
    </dependency>
    <!-- hamcrest -->
    <dependency>
      <groupId>org.hamcrest</groupId>
      <artifactId>hamcrest-core</artifactId>
      <version>2.1</version>
      <scope>test</scope>
    </dependency>
    <!-- junit 4 -->
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>${junit4.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.vintage</groupId>
      <artifactId>junit-vintage-engine</artifactId>
      <version>${junit.jupiter.version}</version>
      <scope>test</scope>
    </dependency>
    <!-- junit 5 -->
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-api</artifactId>
      <version>${junit.jupiter.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-engine</artifactId>
      <version>${junit.jupiter.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apiguardian</groupId>
      <artifactId>apiguardian-api</artifactId>
      <version>1.0.0</version>
      <scope>test</scope>
      <optional>true</optional>
    </dependency>
    <!-- jgiven -->
    <dependency>
      <groupId>com.tngtech.jgiven</groupId>
      <artifactId>jgiven-html5-report</artifactId>
      <version>${jgiven.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.tngtech.jgiven</groupId>
      <artifactId>jgiven-junit</artifactId>
      <version>${jgiven.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.tngtech.jgiven</groupId>
      <artifactId>jgiven-junit5</artifactId>
      <version>${jgiven.version}</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <defaultGoal>clean package</defaultGoal>
    <finalName>${project.artifactId}</finalName>

    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <version>3.2.2</version>
        <configuration>
          <failOnMissingWebXml>false</failOnMissingWebXml>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.7.0</version>

        <configuration>
          <encoding>${project.build.sourceEncoding}</encoding>
          <source>${maven.compiler.source}</source>
          <target>${maven.compiler.target}</target>
        </configuration>
      </plugin>

      <!-- ejb -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-ejb-plugin</artifactId>
        <version>3.0.1</version>

        <configuration>
          <ejbVersion>3.0</ejbVersion>
          <archive>
            <manifest>
              <addClasspath>true</addClasspath>
            </manifest>
          </archive>
        </configuration>
      </plugin>

      <!-- junit 5 -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.22.1</version>
      </plugin>

      <!-- jgiven: `mvn verify` -->
      <plugin>
        <groupId>com.tngtech.jgiven</groupId>
        <artifactId>jgiven-maven-plugin</artifactId>
        <version>${jgiven.version}</version>

        <executions>
          <execution>
            <goals>
              <goal>report</goal>
            </goals>
          </execution>
        </executions>

        <configuration>
          <format>html</format>
          <outputDirectory>${project.build.directory}/jgiven-report</outputDirectory>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <!-- generate findbugs html report `target/site/findbugs.html as part of maven-project-info-report -->
  <reporting>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-site-plugin</artifactId>
        <version>3.7.1</version>

        <configuration>
          <reportPlugins>
            <plugin>
              <groupId>org.codehaus.mojo</groupId>
              <artifactId>findbugs-maven-plugin</artifactId>
              <configuration>
                <!-- specify classes for analysis -->
                <onlyAnalyze>*daggerok*</onlyAnalyze>
              </configuration>
            </plugin>
          </reportPlugins>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>findbugs-maven-plugin</artifactId>
        <version>3.0.5</version>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-project-info-reports-plugin</artifactId>
        <version>3.0.0</version>
        <configuration>
          <skip>true</skip>
        </configuration>
      </plugin>
    </plugins>
  </reporting>

  <!-- deploy -->
  <distributionManagement>
    <repository>
      <id>local-repo</id>
      <url>file://${project.basedir}/target/local-repo</url>
    </repository>
  </distributionManagement>

  <profiles>
    <profile>
      <id>docker</id>
      <build>
        <plugins>
          <plugin>
            <groupId>com.dkanejs.maven.plugins</groupId>
            <artifactId>docker-compose-maven-plugin</artifactId>
            <version>2.2.0</version>
            <executions>
              <execution>
                <id>up</id>
                <phase>verify</phase>
                <goals>
                  <goal>up</goal>
                </goals>
              </execution>
              <execution>
                <id>down</id>
                <phase>verify</phase>
                <goals>
                  <goal>down</goal>
                </goals>
              </execution>
              <execution>
                <id>help</id>
                <phase>verify</phase>
                <goals>
                  <goal>help</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <build>true</build>
              <composeFile>${project.basedir}/docker-compose-maven.yaml</composeFile>
              <detachedMode>true</detachedMode>
              <removeImages>true</removeImages>
              <removeImagesType>local</removeImagesType>
              <removeOrphans>true</removeOrphans>
              <removeVolumes>true</removeVolumes>
              <!--<verbose>true</verbose>-->
              <detail>true</detail>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>docs</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.asciidoctor</groupId>
            <artifactId>asciidoctor-maven-plugin</artifactId>
            <version>1.5.7.1</version>
            <dependencies>
              <dependency>
                <groupId>org.asciidoctor</groupId>
                <artifactId>asciidoctorj-pdf</artifactId>
                <version>1.5.0-alpha.16</version>
              </dependency>
              <dependency>
                <groupId>org.asciidoctor</groupId>
                <artifactId>asciidoctorj-diagram</artifactId>
                <version>1.5.10</version>
              </dependency>
            </dependencies>
            <configuration>
              <outputDirectory>target/generated-docs</outputDirectory>
              <sourceDirectory>docs</sourceDirectory>
              <relativeBaseDir>true</relativeBaseDir>
              <headerFooter>true</headerFooter>
              <imagesDir>.</imagesDir><!-- Don't know why, but yes - use base sources dir... -->
              <attributes>
                <headerFooter>true</headerFooter>
                <toc>left</toc>
                <linkcss>false</linkcss>
                <doctype>book</doctype>
                <ruby>erubis</ruby>
                <encoding>${project.build.sourceEncoding}</encoding>
                <linkattrs>true</linkattrs>
                <numbered>false</numbered>
                <sectanchors>true</sectanchors>
                <sectlink>true</sectlink>
                <idprefix/>
                <docinfo1/>
                <icons>font</icons>
                <idseparator>-</idseparator>
                <setanchors>true</setanchors>
                <toc-title>Table of Contents</toc-title>
                <project-name>${project.artifactId}</project-name>
                <root-project-name>${project.artifactId}</root-project-name>
                <project-version>${project.version}</project-version>
                <github-url>https://github.com/daggerok/${project.artifactId}</github-url>
              </attributes>
            </configuration>
            <executions>
              <execution>
                <id>output-html</id>
                <phase>generate-resources</phase>
                <goals>
                  <goal>process-asciidoc</goal>
                </goals>
                <configuration>
                  <backend>html</backend>
                  <sourceHighlighter>highlightjs</sourceHighlighter>
                </configuration>
              </execution>
              <execution>
                <id>output-docbook</id>
                <phase>generate-resources</phase>
                <goals>
                  <goal>process-asciidoc</goal>
                </goals>
                <configuration>
                  <backend>docbook</backend>
                </configuration>
              </execution>
              <execution>
                <id>output-pdf-doc</id>
                <phase>generate-resources</phase>
                <goals>
                  <goal>process-asciidoc</goal>
                </goals>
                <configuration>
                  <backend>pdf</backend>
                  <sourceHighlighter>coderay</sourceHighlighter>
                  <requires>
                    <require>asciidoctor-diagram</require>
                    <require>coderay</require>
                  </requires>
                  <attributes>
                    <icons>font</icons>
                    <pagenums/>
                  </attributes>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>

        <defaultGoal>clean process-resources</defaultGoal>
      </build>
    </profile>
  </profiles>
</project>
